Advertisement
2_2002-2004 Miscellaneous #115774

[Fast] Remove Duplicates From A Listbox

Removes Duplicates From A Listbox. Fastest one i've seen.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
Sub RemoveDuplicates(ListBox As ListBox)
Dim Col As New Collection
Dim i As Long
On Error Resume Next
If ListBox.ListCount > 1 Then
 For i = 0 To ListBox.ListCount - 1
 Col.Add ListBox.List(i), ListBox.List(i)
 Next
 ListBox.Clear
 For i = 1 To Col.Count
 ListBox.AddItem Col.Item(i)
 Next
 Set Col = Nothing
End If
End Sub
Komentar Asli (3)
Dipulihkan dari Wayback Machine