Insert variables into an Excel document

Copper Contributor

Suppose that I inserted some formulas in the excels cells using as input the cells names, as for example:
Cells(1,1)=  A2*B2 and also Cells(2,1)= A2/B2
In a second time I decided to assign a name to a celles A2 and B2.
To ugrade the formulas in A(1,1) and A(2,1) I normally proceed in this way: open the two cells and replace A2 and B2 with the proper name. And that is Ok
My question is if exist a commanto to ask EXCEL perfom the same operation automatically?
Thanks

4 Replies

Yes there is. On the Formula tab there is a drop-down button called "Define name", choose "Apply names" from that drop-down.

@SergioSolimena 

Since you mention 'Cells' which I associate with Ranges in VBA (Macros), there is the method equivalent to Jan Karel's user interface command:

Cells.ApplyNames

That can take a number of parameters to specify which names are applied and in what circumstances.

Thanks I will try asap.
YES, yours solution works very well! Thanks