Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Corey,
Remember this back on 19 February: You have to clear the error to check the next value. Adjustments made to your code. Same reason then. Private Sub ListBox1_Click() Application.ScreenUpdating = False If ComboBox1.ListCount 0 Then ComboBox1.Clear Dim LastCell As Long Dim myrow As Long Dim nodupes As Collection On Error Resume Next LastCell = Worksheets("Data").Cells(Rows.Count, "BH").End(xlUp).Row With ActiveWorkbook.Worksheets("Data") .Select Set nodupes = New Collection For myrow = 1 To LastCell If .Cells(myrow, 5).Value = ListBox1.Value Then If .Cells(myrow, 60) < "" Then nodupes.Add .Cells(myrow, 60).Value, CStr(.Cells(myrow, 60).Value) If Err.Number = 0 Then ComboBox1.AddItem .Cells(myrow, 60) else err.clear End If End If End If Next End With Application.ScreenUpdating = True End Sub Just trying to help you "learn" this fact -- Regards, Tom Ogilvy "Corey" wrote in message ... Thank you. Perfect. I will add that info to my growing VB vocabulary of knowledge. "merjet" wrote in message oups.com... When a duplicate is found Err.Number < 0 and it stays that way. Between the two "End If" stmts, insert "Err.Clear". That will reset Err.Number = 0 and allow more additions. Hth, Merjet |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display only duplicate values and delete UNIQUE Items | Excel Discussion (Misc queries) | |||
HOW DO I REMOVE UNIQUE VALUES IN EXCEL? | Excel Worksheet Functions | |||
Remove Duplicate Values | Excel Programming | |||
Return Unique Consecutive Duplicate Values across Single Row | Excel Worksheet Functions | |||
Return Unique Duplicate Numeric Values across Single Row | Excel Worksheet Functions |