27 | 06 | 2017

Delete duplicates in Listbox

 The sub below deletes al duplicate items in a listbox.

Public Sub RemoveListBoxDuplicates(LVobject As ListBox)

'*******************************
'*** Code from VisibleVisual ***
'*******************************

Dim rowA As Integer
Dim rowB As Integer

With LVobject


For rowA = 0 To .ListCount - 1

    For rowB = .ListCount To (rowA + 1) Step -1
    
        If .List(rowB) = .List(rowA) Then
        .RemoveItem rowB
        End If
    
    Next
Next

End With

End Sub
Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2288468
Latest Articles