Reset Collection
Sub abc()
Dim col As Collection
For i = 1 To 10
' Set col = Nothing
Set col = New Collection
Max = Int(Rnd() * 15 + 1)
For j = 1 To Max
k = Int(Rnd() * (Max / 2) + 1)
On Error Resume Next
col.Add k, CStr(k)
On Error GoTo 0
Next
Debug.Print col.Count
Next
End Sub
worked with or without the commented out line. (xl2003)
--
Regards,
Tom Ogilvy
"Minitman" wrote:
Greetings,
Norman Jones helped me with a neat trick using a Collection to remove
duplicate entries from a range. I works great - for the first range -
after that it keeps giving a permission denied error. I think it
might have something to do with the method of resetting the
collection.
Anyone know the best way to load a ComboBox with the contents of a
collection and then reset the collection to fill the next ComboBox?
Any help is much appreciated.
TIA
-Minitman
|