One way:
First, you should NEVER "Dim as New". See the "Don't Use The New Keyword
In A Dim Statement" section he
http://cpearson.com/excel/variables.htm
Doing so adds hidden overhead that slows your code
Dim colMyCollection As Collection
Dim i As Long
Set colMyCollection = New Collection
For i = 1 To 10
colMyCollection.Add Cells(i, 1)
Next i
Debug.Print colMyCollection.Count
Set colMyCollection = Nothing
Set colMyCollection = New Collection
Debug.Print colMyCollection.Count
I suspect the Set colMyCollection = Nothing isn't strictly necessary,
but it seems appropriate to me...
In article ,
Max wrote:
I have created a collection using:
dim collMycollection as new collection
and populated it. Now I want to clear it and reuse it. What is the command
to do so? I've tried:
collMycollection.clear
But that doesn't seem to be supported. Any ideas?