Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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") |
#2
![]() |
|||
|
|||
![]()
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 "Bill Christian" <Bill wrote in message ... |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") | |
#3
![]() |
|||
|
|||
![]()
Hi Bill,
Yes, you can and the sintax is identical: Set Total_Assets = Sheets("Balance Sheet").Range("MyDefinedName") Regards, KL "Bill Christian" <Bill wrote in message ... 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") |
#4
![]() |
|||
|
|||
![]()
Thanks to Jim & KL. My macro is now more readable and bullet proof.
"KL" wrote: Hi Bill, Yes, you can and the sintax is identical: Set Total_Assets = Sheets("Balance Sheet").Range("MyDefinedName") Regards, KL "Bill Christian" <Bill wrote in message ... 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") |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sharing macros | Excel Discussion (Misc queries) | |||
Enabling macros | Excel Discussion (Misc queries) | |||
Transferring toolbars and macros to other computers | Excel Discussion (Misc queries) | |||
The available macros list in XL; how to suppress filename from showing | Excel Discussion (Misc queries) | |||
Macros disappear after a file is imported | Excel Discussion (Misc queries) |