View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Still stuck removing duplicate values

I posted a correction to that line in the original thread in response to
your post that you were getting an error. It was a typo on my part.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
Tom,
I kept getting an error in one line and could not work out how to fix it.

nodupes Cells(myrow, 2).Value, CStr(Cells(myrow, 2).Value) "==== Wrong
Number of Arguements ????



"Tom Ogilvy" wrote in message
...
Try using the code that was already provided which used a collection to
insure only unique entries were included. .



--
Regards,
Tom Ogilvy

"Corey" wrote in message
...
The below code populates a listbox for me, but i want ONLY unique values
listed, currently i am
getting a few duplicate values populating in the listbox.
How can i remove them to ONLY display 1 value of the duplicate values ?

Private Sub ListBox1_Change()
Application.ScreenUpdating = False
If ComboBox1.ListCount 0 Then ComboBox1.Clear
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("Contact List").Cells(Rows.Count,
"A").End(xlUp).Row

With ActiveWorkbook.Worksheets("Contact List")
.Select 'first thing to do with a With statement that occurs on a second
sheet
For myrow = 1 To LastCell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(0, 1).Value = ListBox1.Value Then
ComboBox1.AddItem Cells(myrow, 1)
End If
End If
Next
End With
Application.ScreenUpdating = True

End Sub


Corey....