View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Free old variables

Maybe using Erase would work for you:


Dim myArray(1 To 100) As Long
Dim iCtr As Long
For iCtr = LBound(myArray) To UBound(myArray)
myArray(iCtr) = iCtr
Next iCtr
Erase myArray



Jeff wrote:

Hi,

I have a macro that I run am running - here is the problem.

I have an array of values that is populated in the macro. It is a public
variable and I cannot make it local. When I rerun the array keeps its old
values.

Question - is there anyway to zero out the array again - I was just using
the loop at the beginning of the macro
For i =1 to 100
array(i) =0
Next i

... but is there a better way?

Thanks for your help


--

Dave Peterson