Hi,
Hopefully someone can help. I currently have a code for a macro that searches a column to see if there are any duplicates found in that column after it is sorted. It then highlights the cell red and continues to search for duplicates. It runs until the cell is empty because the row number is unknown. I want to know how can i modify the following code to continue doing the necessary function but it comes across a blank cell to skip it and try the next cell in that column. If it comes across 3 empty cells in a row then it should terminate the process and move on. Any help is greatly appreciated I posted a few times the last few days and this is my last step needed. Thank You!
Sub FindDups ()
'
' NOTE: You must select the first cell in the column and
' make sure that the column is sorted before running this macro
'
ScreenUpdating = False
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1, 0).Value
Offsetcount = 1
Do While ActiveCell <> ""
'Matches firstitem with second item if they match turn red and move onto next cell
If FirstItem = SecondItem Then
ActiveCell.Offset(Offsetcount,0).Interior.Color = RGB(255,0,0)
Offsetcount = Offsetcount + 1
SecondItem = ActiveCell.Offset(Offsetcount, 0).Value
Else
ActiveCell.Offset(Offsetcount, 0).Select
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1,0).Value
Offsetcount = 1
End If
Loop
ScreenUpdating = True
End Sub
Bookmarks