Thread: Static Variable
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
IanC[_2_] IanC[_2_] is offline
external usenet poster
 
Posts: 157
Default Static Variable

You probably need to pass the variable to the subroutine

Sub test(myvariable)
' your code here
End Sub

--
Ian
--

"WLMPilot" wrote in message
...
I am using a userform. When "ENTER" commandbutton is clicked, it runs a
macro. In this macro I have a static variable, counter, that increments
by
one each time through. When I added a command in the macro to call a
subroutine, the counter no longer maintains the correct value. When I use
msgbox to check the value, it is blank.

Up until the point prior to adding the call for the subroutine, the
counter
worked fine.

What happened and what can I do to fix it?

Thanks,
Les