Search This Blog

Friday 27 January 2012

CODE FOR HIGHLIGHTING DUPLICATE VALUES

Sub highlight_duplicates()

Dim i, j As Integer
Dim mycheck, rng
Application.ScreenUpdating = False
rng = Selection.Rows.Count
For i = rng To 1 Step -1
mycheck = ActiveCell
ActiveCell.Offset(1, 0).Select
For j = 1 To i
If ActiveCell = mycheck Then
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
End If
ActiveCell.Offset(1, 0).Select
Next j
ActiveCell.Offset(-i, 0).Select
Next i
Application.ScreenUpdating = True
End Sub

No comments:

Post a Comment