Insert variables into an Excel document

%3CLINGO-SUB%20id%3D%22lingo-sub-394571%22%20slang%3D%22en-US%22%3EInsert%20variables%20into%20an%20Excel%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-394571%22%20slang%3D%22en-US%22%3E%3CP%3ESuppose%20that%20I%20inserted%20some%20formulas%20in%20the%20excels%20cells%20using%20as%20input%20the%20cells%20names%2C%20as%20for%20example%3A%3CBR%20%2F%3ECells(1%2C1)%3D%26nbsp%3B%20A2*B2%20and%20also%20Cells(2%2C1)%3D%20A2%2FB2%3CBR%20%2F%3EIn%20a%20second%20time%20I%20decided%20to%20assign%20a%20name%20to%20a%20celles%20A2%20and%20B2.%3CBR%20%2F%3ETo%20ugrade%20the%20formulas%20in%20A(1%2C1)%20and%20A(2%2C1)%20I%20normally%20proceed%20in%20this%20way%3A%20open%20the%20two%20cells%20and%20replace%20A2%20and%20B2%20with%20the%20proper%20name.%20And%20that%20is%20Ok%3CBR%20%2F%3EMy%20question%20is%20if%20exist%20a%20commanto%20to%20ask%20EXCEL%20perfom%20the%20same%20operation%20automatically%3F%3CBR%20%2F%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-394571%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-394709%22%20slang%3D%22en-US%22%3ERe%3A%20Insert%20variables%20into%20an%20Excel%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-394709%22%20slang%3D%22en-US%22%3EYES%2C%20yours%20solution%20works%20very%20well!%20Thanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-394705%22%20slang%3D%22en-US%22%3ERe%3A%20Insert%20variables%20into%20an%20Excel%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-394705%22%20slang%3D%22en-US%22%3EThanks%20I%20will%20try%20asap.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-394664%22%20slang%3D%22en-US%22%3ERe%3A%20Insert%20variables%20into%20an%20Excel%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-394664%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F314091%22%20target%3D%22_blank%22%3E%40SergioSolimena%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESince%20you%20mention%20'Cells'%20which%20I%20associate%20with%20Ranges%20in%20VBA%20(Macros)%2C%20there%20is%20the%20%3CSPAN%3Emethod%20%3C%2FSPAN%3Eequivalent%20to%20Jan%20Karel's%20user%20interface%20command%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3ECells.ApplyNames%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThat%20can%20take%20a%20number%20of%20parameters%20to%20specify%20which%20names%20are%20applied%20and%20in%20what%20circumstances.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-394633%22%20slang%3D%22en-US%22%3ERe%3A%20Insert%20variables%20into%20an%20Excel%20document%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-394633%22%20slang%3D%22en-US%22%3E%3CP%3EYes%20there%20is.%20On%20the%20Formula%20tab%20there%20is%20a%20drop-down%20button%20called%20%22Define%20name%22%2C%20choose%20%22Apply%20names%22%20from%20that%20drop-down.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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
Highlighted

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

Highlighted

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

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