Varible scope

  • Thread starter Thread starter miek
  • Start date Start date
M

miek

Is it possible to declare a varible that can be seen (availble) from any
Sub(routine) within the current Module1?

If so How
 
Declare the variable outside of and before any procedure declaration. Use
"Public" instead of "Dim" if you want to variable to be visible from any
module (not just the module in which it is declared) or use "Private"
instead of "Dim" if you want the variable to be visible only from within the
module in which it is declared.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
At the top of the module:
Dim myVar as Variant 'or whatever.

Use:
Public myVar as Variant
If you want it seen in all modules.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top