Define Name use in Macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am not sure how or if you can use the Define Name function in a worksheet
to assign a value in an Macro. I am using the command below to assign a value
in the worksheet in the macro. However the user might make changes to the
worksheet that makes this method invalid. If I use the Define Name function
in excel and create a Name can I then us it to assign a value?

Set Total_Assets = Sheets("Balance Sheet").Range("H55")
 
You should definitely assign a name (Ctrl-F3) to this cell and all ranges
your macros used, in case you or your users insert rows, etc.

Set Total_Assets = Sheets("Balance Sheet").Range("TotAssets")


--
Jim
|I am not sure how or if you can use the Define Name function in a worksheet
| to assign a value in an Macro. I am using the command below to assign a
value
| in the worksheet in the macro. However the user might make changes to the
| worksheet that makes this method invalid. If I use the Define Name
function
| in excel and create a Name can I then us it to assign a value?
|
| Set Total_Assets = Sheets("Balance Sheet").Range("H55")
|
 
Hi Bill,

Yes, you can and the sintax is identical:

Set Total_Assets = Sheets("Balance Sheet").Range("MyDefinedName")


Regards,
KL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top