ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Global variable (https://www.excelbanter.com/excel-programming/280737-global-variable.html)

Don[_11_]

Global variable
 
Is there any way to have the same variable available to a
worksheet function (e.g. button_click) and a sub
procedure in a code module. I need to have the same
variable (an index in a for loop) available to both. Any
thoughts?

Robert Rosenberg[_2_]

Global variable
 
Declare the variable publicly (preferrably at the top of a ) module, like...

Public gvVariable as Variant

or

Global gvVariable as Variant

--
_______________________
Robert Rosenberg
R-COR Consulting Services
Microsoft MVP - Excel
"Don" wrote in message
...
Is there any way to have the same variable available to a
worksheet function (e.g. button_click) and a sub
procedure in a code module. I need to have the same
variable (an index in a for loop) available to both. Any
thoughts?





All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com