![]() |
Free old variables
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 |
Free old variables
Erase ArrayName
-- Jim "Jeff" wrote in message ... | 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 |
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 |
All times are GMT +1. The time now is 07:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com