Mega Code Archive
Theres a potential problem when you try to resize the array
Sub ResizeDynamic()
Dim astrNames() As String
Dim intCounter As Integer
Dim vntAny As Variant
'Resize the array to hold two elements
ReDim astrNames(1)
astrNames(0) = "A"
astrNames(1) = "B"
'Resize the array to hold four elements
ReDim astrNames(3)
'Populate the last two elements
astrNames(2) = "C"
astrNames(3) = "D"
For Each vntAny In astrNames
Debug.Print vntAny
Next vntAny
End Sub