title: Remove duplicate rows from listbox
body: <p>Creating a userform to search through information contained in an eight column worksheet and display the matching rows in a listbox. The listbox displays eight columns of data too. Through some research, I found a link with some helpful information ("<a href="http://www.mrexcel.com/forum/excel-questions/580692-how-delete-duplicates-listbox.html" rel="nofollow">http://www.mrexcel.com/forum/excel-questions/580692-how-delete-duplicates-listbox.html</a>", but it's not producing the desired output. Here's the code from my workbook:</p>
  
  <pre><code>Sub FindPastDueCustomers
      Dim i As Long, j As Long
      Dim nodupes As New Collection
      Dim Swap1, Swap2, Item
  
      With frm_Customers.lbox_Customers
  
          For i = 0 To .ListCount - 1
              ' The next statement ignores the error caused
              ' by attempting to add a duplicate key to the collection.
              ' The duplicate is not added - which is just what we want!
              On Error Resume Next
              nodupes.Add .List(i), CStr(.List(i))
          Next i
  
      '   Resume normal error handling
          On Error GoTo 0
  
          'Clear the listbox
          .Clear
  
          'Sort the collection (optional)
          For i = 1 To nodupes.Count - 1
              For j = i + 1 To nodupes.Count
                  If nodupes(i) &gt; nodupes(j) Then
                      Swap1 = nodupes(i)
                      Swap2 = nodupes(j)
                      nodupes.Add Swap1, before:=j
                      nodupes.Add Swap2, before:=i
                      nodupes.Remove i + 1
                      nodupes.Remove j + 1
                  End If
              Next j
          Next i
  
      '   Add the sorted and non-duplicated items to the ListBox
          For Each Item In nodupes
              .AddItem Item
          Next Item
  
      End With
  '   Show the UserForm
      frm_Customers.Show
  End Sub
  </code></pre>