Static variables

  • Thread starter Thread starter lynnnow
  • Start date Start date
L

lynnnow

Hi,

I've got a startup Sub which has a msgbox with Y/N option. Thereafte
it shows the Application.GetOpenFilename option and the file names ar
stored to variables. Then I've got a userform that has comboboxes i
it and after this private Sub is over, I need the variables that
created in the startup Sub. These variables show Empty in the Watc
section or it shows an Out of Subscript error.

How can I keep these variables static so that I can use it later. I'v
tried using Static, but it does not help

Txs
 
Use a variable declared as Public at the top of a general module (and above
any subs or functions).
 
lynnnow,
You need to understand the concept of "Scope". Check Help.

NickHK
 
If all fails, you can store such variables in a worksheet. Leave it as "very
hidden" and pass the variables to the cells.
 

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

Similar Threads


Back
Top