Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA reseting variables
By declaring the variables outside a sub, they're not only available to other
subs but they'll also retain their values (til you close the file, at least). If there's a point at which they should be reset, you'll have to explicitly perform that step in your macro, probably at the start of your Main macro. If the variables should never retain their values, you might just add a series of assignments at the beginning of your Main sub: Var1 = Nothing: Var2 = Nothing, ... "Jeff" wrote: Hi, I have a Module with about 10 seperate macros? I mean these -- "Sub Macros()" I have declared variables at the top of the module so that each macro can use the variable that is reset periodically in other macros. Then I have this combobox that calls a Main macro that calls the macros and basically calculates a fund. The problem is that when I run the macro, (and the values of the fund are print out on a sheet in the workbook), and then run it again, the values change. So I am assuming that some of the variables are not being reset or "hold onto" their previous value. The fund should not change because I am running the same values. Does anyone have any advice if the variables are not being reset, or if there is a way to automatically reset the variables? i would appreciate any help on this thanke |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing Variables | Excel Discussion (Misc queries) | |||
augmenter le nombre de cellules variables du solveur excel | Excel Discussion (Misc queries) | |||
How do I use variables in Excel? | Excel Discussion (Misc queries) | |||
How do I use variables in Excel? | New Users to Excel | |||
Plot 2 variables on Y axis | Charts and Charting in Excel |