I found this code for deleting duplicates in a ListBox. I'm calling it from another Sub and the name of the list is "lstLeft" on a user form called "frmOptions". How do I call the KillDupes and specify what the list box name is.
Rich (BB code):
Sub Kill_LBDupes(LB As ListBox)
Dim idxLoop As Integer
Dim idxCheck As Integer
idxLoop = 0
Do While idxLoop < LB.ListCount - 1 'Stop on 2nd from last item
idxCheck = idxLoop + 1
Do While idxCheck <= LB.ListCount - 1 'Stop on last item
If LB.List(idxCheck) = LB.List(idxLoop) Then
LB.RemoveItem idxCheck
'We do not increment idxCheck here since the rest of the items are reindexed in the ListBox
Else
idxCheck = idxCheck + 1
End If
Loop
idxLoop = idxLoop + 1
Loop
End Sub
Sub CallFrom()
KillDupes....????
End Sub