Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just curious about using 'Public' to define variables. Is there a 'more
correct' place to list variables that you want used by all modules in a project? Module 1? Form Code module (if you are using a menu)? Completely separate module? Also curious about how VBA works here. Does it read through all modules when you open a project and pull the 'Public' variables? Or do you have to use code in a particular module before it picks up any variables listed in that module? -- Bill @ UAMS |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Public variables are typically placed in a standard code module.
It doesn't matter which code module. If you have only one module, put them there. In a large project, you might want to devote a module exclusively to public variable. This would be done only for organizations -- it would have no impact on execution of code. Don't put Public variables in the ThisWorkbook module, a userform's code module or a worksheet's code module unless you have good reason to do so and you know what you're doing. VBA will recognize all public variables at the same time. You don't have to run code in a module for that module's public variables to be 'recognized'. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "BillCPA" <Bill @ UAMS wrote in message ... Just curious about using 'Public' to define variables. Is there a 'more correct' place to list variables that you want used by all modules in a project? Module 1? Form Code module (if you are using a menu)? Completely separate module? Also curious about how VBA works here. Does it read through all modules when you open a project and pull the 'Public' variables? Or do you have to use code in a particular module before it picks up any variables listed in that module? -- Bill @ UAMS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
date format problem | Excel Discussion (Misc queries) | |||
Account for Public Holidays | Excel Discussion (Misc queries) | |||
How do I link to an Outlook public folder from an Excel spreadshe. | Excel Discussion (Misc queries) | |||
Problem accessing Oracle Public Synonyms from Microsoft Excel 2002 | Excel Discussion (Misc queries) | |||
Public Function | Excel Discussion (Misc queries) |