- Initializing an array - Empty
ReDim Preservewhen i m in the first loop iteration- When i use
ReDimthe code works fine - increase the size of the array, but the previous part of the array get empty.
- BUT in the second iteration i get an error in the line
ReDim Preserve arrTips(Counterarr, 5)when i m trying to increase the size of the array.
Code:
Option Explicit
Sub test()
Dim arrTips() As Variant
Dim i As Long, Counterarr As Long
'Set counter to start array
Counterarr = 0
For i = 1 To 10
'Increase array lenght
ReDim Preserve arrTips(Counterarr, 5)
arrTips(Counterarr, 0) = ""
arrTips(Counterarr, 1) = ""
arrTips(Counterarr, 2) = ""
arrTips(Counterarr, 3) = ""
arrTips(Counterarr, 4) = ""
arrTips(Counterarr, 5) = ""
Counterarr = Counterarr + 1
Next i
End Sub

