JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
Is there a way for me to declare a variable in a UDF so that it will be available to any UDF that it calls?
I tried
but they both got error messages.
A search turned up several webpages about global variables, but they all seem to indicate that I need to define the variables outside of the main UDF and that they then continue to exists as long as that workbook is open. I don't want that.
I just want the variables to be available to the main UDF and any that it calls and then go away when the main UDF exits.
Can that be done?
Thanks
I tried
Code:
Public varname as double
Global varname as double
A search turned up several webpages about global variables, but they all seem to indicate that I need to define the variables outside of the main UDF and that they then continue to exists as long as that workbook is open. I don't want that.
I just want the variables to be available to the main UDF and any that it calls and then go away when the main UDF exits.
Can that be done?
Thanks