Variable Scope

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

How do I set variables that will remain in scope as long
as my application is open. I need to set several variables
that I need to access (and possibly modify) at any time
after it is initially set while my application is open.

Help here would be greatly appreciated!

Thanks!

Kevin
 
At the top of a standard module outside any procedure

Public Myvar as Variant
Public MyString as String

for example.

then in the workbook_open event in the ThisWorkbook Module

Private Sub workbook_Open()
Myvar = 21
MyString = "Today is " & format(date,"mm/dd/yyyy")

End Sub
 

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