Sub DynamicArray()
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"
'Use a For...Each loop to loop through the
'elements of the array
For Each vntAny In astrNames
Debug.Print vntAny
Next vntAny
End Sub
|