i have an array like this:
Dim aFirstArray() As Variant
how do i clear the entire array>?
what about a collection?
i have an array like this:
Dim aFirstArray() As Variant
how do i clear the entire array>?
what about a collection?
You can either use the Erase
or ReDim
statements to clear the array:
Dim threeDimArray(9, 9, 9), twoDimArray(9, 9) As Integer
Erase threeDimArray, twoDimArray
ReDim threeDimArray(4, 4, 9)
See the different usage of each method here.
Update
To remove a collection, you iterate over its items and use the remove
method:
For i = 1 to MyCollection.Count
MyCollection.Remove 1 ' Remove first item
Next i