Basically delare the variable as Public outside any procedures, within a module. For example in module1
Code:
Option Explicit
Public myVar As String
Then in module2 and sheet1 module you may have the following code respectively which will pick up the declaration of the variable from module1.
Code:
Option Explicit
Sub a()
myVar = Format(Now, "hh:mm:ss")
MsgBox myVar
End Sub
and
Code:
Option Explicit
Private Sub Worksheet_Activate()
myVar = Format(Now, "hh:mm:ss")
MsgBox myVar
End Sub
Hope this helps!
;-)
If a man says something and there are no women there to hear him, is he still wrong?
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.