Private Sub RemoveDupes(lst As ListBox)
Dim iPos As Integer iPos=0 '-- if listbox empty then exit.. If lst.ListCount < 1 Then Exit Sub Do While iPos < lst.ListCount lst.Text = lst.List(iPos) '-- check if text already exists.. If lst.ListIndex <> iPos Then '-- if so, remove it and keep iPos.. lst.RemoveItem iPos Else '-- if not, increase iPos.. iPos = iPos + 1 End If Loop '-- used to unselect the last selected l ' ine.. lst.Text = "~~~^^~~~" End Sub |