M
Mike Fogleman
I have a huge amount of code, over 80 subs, spread over 4 general modules,
with a userform and workbook open & close. Most variables are keeping their
last value when the routine has ended. When I run the routine again, on
different data, the results are not correct. Re-running the routine
immediately on this data works.
2 questions: VB help says a variable will retain its' scope when calling one
sub from another. I have found that if the called sub is in another module,
scope is lost. Is this normal? Declaring the variable Public in the
originating module works, so I have a lot of Public variables to keep the
code running as it criss-crosses the 4 modules.
Second, is there a global way to reset the variables between runs, like the
Reset button on the VB Editor?
TIA, Mike
with a userform and workbook open & close. Most variables are keeping their
last value when the routine has ended. When I run the routine again, on
different data, the results are not correct. Re-running the routine
immediately on this data works.
2 questions: VB help says a variable will retain its' scope when calling one
sub from another. I have found that if the called sub is in another module,
scope is lost. Is this normal? Declaring the variable Public in the
originating module works, so I have a lot of Public variables to keep the
code running as it criss-crosses the 4 modules.
Second, is there a global way to reset the variables between runs, like the
Reset button on the VB Editor?
TIA, Mike