Sub RemoveDupes()
' Defines variables
Dim x As Long, LastRow As Long, DupeCount As Long, cRange As Range
' Defines LastRow as the last row of data based on column A
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
' Sets the check range as A1 to the last row of A
Set cRange = Range("A1:A" & LastRow)
' Sets DupeCount to zero
DupeCount = 0
' Update status bar
Application.StatusBar = "Highlighting Duplicates...Please Wait"
' Disables screen updating to reduce flicker
Application.ScreenUpdating = False
' For each cell in the check range, working from the bottom upwards
For x = cRange.Cells.Count To 1 Step -1
With cRange.Cells(x)
' If the count of the cell value is more than 1 then...
If Application.WorksheetFunction.CountIf(cRange, .Value) > 1 Then
' Highlight that row with yellow fill
.EntireRow.Interior.ColorIndex = 6
DupeCount = DupeCount + 1
End If
End With
' Check next cell in check range
Next x
' Re-enables screen updating
Application.ScreenUpdating = True
' Update status bar
Application.StatusBar = "Task Complete"
' Optional message box confirming task is complete
MsgBox DupeCount & " Duplicates Highlighted", vbOKOnly, "Task Complete!"
End Sub