#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,718
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.misc
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
any free add-ins? driller Excel Discussion (Misc queries) 4 November 15th 06 08:27 PM
any free add-ins? driller Excel Worksheet Functions 4 November 15th 06 08:27 PM
Free HP Notebook teesi12 Excel Discussion (Misc queries) 0 August 18th 06 12:48 PM
Are there any free XL widgets out there ... Speedmaster Excel Discussion (Misc queries) 2 February 22nd 06 03:49 PM
Free Add Ins for Excel?? Sooraj Excel Discussion (Misc queries) 3 January 18th 05 01:34 PM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"