PDA

View Full Version : Dim



chungtinhlak
12-08-2008, 02:02 PM
I have a Module with many sub in it. Dim everything over when I'm working in a different sub?

Thanks

Bob Phillips
12-08-2008, 02:15 PM
Public myVar As Long

Sub abc()

myVar=16
Cal xyz
End Sub

Sub xyz()

Msgbox myVar
End SUb

chungtinhlak
12-08-2008, 02:52 PM
how do you do a global variable independent of sub?

thanks

Kenneth Hobs
12-08-2008, 03:11 PM
It was in the first line of xld's code:
Public myVar as Long

Public variables are stored at the top of any Module.