Here's what I use. The first thing it does is select the first cell of the
column to be examined - I use Col. C; change to reflect your needs. This
column must be sorted either ascending or descending, so any duplicate
entries are together. The macro runs down the column - if it finds a set of
duplicates, the entry in the top cell is replaced with AAA, and the bottom
cell is filled in red. The AAA makes it easy to Edit>>Find or AutoFilter.
One of the last things it does is puts a formula below the last entry in
Col. D that counts how many duplicate entries were detected. Change if Col.
D isn't good for you.
Hope it works.
Ed
Sub FindDups()
'
' Select column
Range("C1").Select
ScreenUpdating = False
' Run down column and compare numbers
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1, 0).Value
Offsetcount = 1
' If the numbers are the same
Do While ActiveCell <> ""
If FirstItem = SecondItem Then
' Turns the second one red
ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0)
' Replaces first cell value with AAA
ActiveCell.FormulaR1C1 = "AAA"
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
'Puts formula to count AAA values in D column
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C:C,AAA)"
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-1],""AAA"")"
ActiveCell.Select
End Sub