Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables
Why do my variable seem to not be global? I have two subs:
Sub A() Static CountRows As Long CountRows = 1 MsgBox (CountRows) End Sub This one shows that CountRows = 1 Sub Bt() Static CountRows As Long MsgBox (CountRows) End Sub But when I run this one it does not remember CountRows = 1, and resets it to zero. Why? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables
You need to Dim you variable outside and before your Subs. This make them
"global". -- Gary''s Student "Mike" wrote: Why do my variable seem to not be global? I have two subs: Sub A() Static CountRows As Long CountRows = 1 MsgBox (CountRows) End Sub This one shows that CountRows = 1 Sub Bt() Static CountRows As Long MsgBox (CountRows) End Sub But when I run this one it does not remember CountRows = 1, and resets it to zero. Why? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
Too Many Variables | Excel Worksheet Functions | |||
More than 1 Variables | Excel Discussion (Misc queries) | |||
Using variables in RCs | Excel Programming | |||
Variables | Excel Programming |