ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   public variable (https://www.excelbanter.com/excel-programming/276147-public-variable.html)

marwan hefnawy

public variable
 
I have declared a Public variable in "ThisWorkbook" module level.
Then I gave it a value in the event procedure Workbook_Open()
the problem is that when I use this variable in other modules, it is not
recognized.
anyone knows what is the problem?
I want to assign a value to a variable once (at workbook opening or at
worksheet opening) then I want to use this variable value in all modules,
How to make it/
Thanks in advance.




papou[_7_]

public variable
 
Hello Marwan
Declare your variable in a standard module not in Thisworkbook which is
private.
Assign your value in the Workbook_Open event
Regards
Pascal

"marwan hefnawy" a écrit dans le message de
...
I have declared a Public variable in "ThisWorkbook" module level.
Then I gave it a value in the event procedure Workbook_Open()
the problem is that when I use this variable in other modules, it is not
recognized.
anyone knows what is the problem?
I want to assign a value to a variable once (at workbook opening or at
worksheet opening) then I want to use this variable value in all modules,
How to make it/
Thanks in advance.







All times are GMT +1. The time now is 11:04 AM.

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