vba array redim preserve code example
Example: redim array vba
Redim MyArray(10) ' Resize to 10 elements.
For i = 1 To 10 ' Loop 10 times.
MyArray(i) = i ' Initialize array.
Next i
'You can resize just the left-most dimension of the array
Redim Preserve MyArray(15) ' Resize to 15 elements.