Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're right. I work so much in the IDE that I got tired of finding my
variables reset by my debugging and I got in the habit of initializing them as necessary. "Dave Peterson" wrote: You don't need the Call keyword, but it doesn't hurt. I like it. I'd also add a check to see if re-initializing the variables was required (as you saw). But I don't understand your point about why/how the variables are reset. Those public and static variables don't get reset just because the code isn't running. Charlie wrote: It's not about "No code is running", it's "code is NOT running" that resets the variables. I learned the hard way: I don't bother with initializing much in the Workbook_Open event anymore. I put my initializations at the beginning of every event as necessary (and you don't need the "Call" keyword), e.g. Private Sub Worksheet_Activate() InitializeVars ...Do Stuff End Sub Private Sub Worksheet_Change(ByVal Target As Range) InitializeVars ...Do Stuff End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) InitializeVars ...etc. End Sub " wrote: But then again... No code is running between the execution of the Workbook_Open event and the execution of Routine2. Maybe that was not the answer after all. -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Global variables | Excel Programming | |||
global variables | Excel Programming | |||
Global Variables | Excel Programming | |||
Global Variables | Excel Programming | |||
Global Variables | Excel Programming |