If I end the code with End Sub I get an error message that the program was expecting End With. When I use End With the program was expecting End Sub.
Also within the following code can someone tell me exactly and only which lines to take out so the macro will stop counting empty cells. I only need to delete duplicate rows.
Sub DeleteDuplicateEntries()
Dim rClMain As Range
Dim rClDupe As Range
Dim rCheck
Dim N As Long
Application.ScreenUpdating = False
N = 0
'currently starts in A2 down,adjust to your data
Set rCheck = Range(Cells(2, 1), Cells(Rows.Count, 1).End(xlUp))
For Each rClMain In rCheck
'1st loop - (to speed things up ignore any empty cells)
If rClMain <> Empty Then
For Each rClDupe In rCheck
'2nd loop - compare non-empty rClDupe values
'and clear contents if it's a duplicated value
If rClDupe <> Empty And _
rClDupe.Value = rClMain.Value And _
rClDupe.Address <> rClMain.Address Then
rClDupe.EntireRow.Delete
N = N + 1
End If
Next rClDupe
End If
Next
Application.ScreenUpdating = True
MsgBox "There were " & N & " duplicated entries deleted"
End Sub
Bookmarks