Reset Collection
"Tom Ogilvy" skrev i en meddelelse
...
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
Sub abc()
Dim col As New 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
also works with or without the commented out line. (xl2003)
--
Best regards
Leo Heuser
|