redimension array code example
Example 1: 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.
Example 2: vba redim
' Used at the procedure level to reallocate storage space for dynamic array variables.
' Example
Dim arr() as Long
ReDim ar() 'creates new array "ar" - "ReDim ar()" acts like "Dim ar()"