View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default array inside for statement

So you want to resize the array each time you loop? If so then take a look at
ReDim Preserve. Something like this...

Sub Tada()
Dim MyArray() As Long
Dim lng As Long

For lng = 0 To 9
ReDim Preserve MyArray(lng)
MyArray(lng) = lng
Next lng

For lng = LBound(MyArray) To UBound(MyArray)
MsgBox MyArray(lng)
Next lng
End Sub
--
HTH...

Jim Thomlinson


"Student" wrote:

Hello
i have an array inside a for statment and i was to reset the array everytime
the for statment run
how may i rest an array
please advice thank you