PDA

View Full Version : Prevent variable from being initialized



frubeng
05-07-2009, 10:38 AM
Hello,

I run the macro

Sub main()
Call check(Workbooks("Outlier").Sheets("Spreadsheet").range("A30:A600"))
End Sub


In this check function, it runs through my spread sheet and when it finds something to print, it checks that it hasnt been printed before. It uses this (inside a sub that is called inside check)

For I = 1 To (warning_rows)
If (Minute(Now) > refresh_rate + mytimes(I) And mynames(I) = C.Value) Then
Exit Sub
End If
Next I

And everytime i write something, i memorize it in those two arrays:
myindicators(counter(which), which) = Indicator
mytimes(counter(which), which) = Minute(Now)

The problem is that as the main macro runs over and over again, the arrays myindicators and mytimes seem to get initialized and so the check for duplication is not sufficient.

How would I prevent those arrays from being initialized?

Thank you!

Bob Phillips
05-07-2009, 01:15 PM
Where have you declared those arrays? Make them public before any macros in the module.

frubeng
05-08-2009, 07:28 AM
Great, i declare them as Public in a separate module. Thanks very much!!