Forum Discussion

SergioSolimena's avatar
SergioSolimena
Copper Contributor
Apr 04, 2019

Insert variables into an Excel document

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

  • 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.

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

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

Resources