LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Life of a variable

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
!very important for your life... [email protected] Excel Worksheet Functions 0 March 27th 09 03:45 PM
life contingencies sylphide Excel Worksheet Functions 1 February 2nd 06 01:51 PM
asset life otrain Excel Discussion (Misc queries) 1 November 19th 05 12:02 AM
Money for life mike Excel Discussion (Misc queries) 0 February 25th 05 10:28 AM
Variable life morph Excel Programming 1 December 3rd 03 10:57 PM


All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"