Automatically resest variable values = 0 after runtime
Why exactly do you need to reset ALL of them? In a situation where a value
is used to recalculate itself, such as
n = n + 1
then, yes, you need to reset. But for most calcs
a = b + c
you would not need to reset "a" first. And I presume "b" and "c" would be
obtained from some external source, and THEY would not need to be reset first
either.
Post some code.
"RyanH" wrote:
I have about 40 variables at the top of a Userforms Declaration section. I
do this because I need the variables calculated in one procedure and made
available to another procedure when they are all done being calulated.
The problem is I currently have to write code to reset all the variables
back to 0 before they are recalculated. If there a way to declare the
variable (DataType Single) = 0 at the beginning of runtime. For example:
Option Explicit
Dim var1 As Single = 0
Dim var2 As Single = 0
Private Sub CalculateVariables()
' code to calculate var1 & var2
End Sub
Private Sub UseVariables
' code to use var1 & var2
End Sub
After runtime var1 & var2 are reset to 0
--
Cheers,
Ryan
|