This code highlights duplicate values in the selected range.
VBA Code:
Sub HighlightDuplicates()
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).DupeUnique = xlDuplicate
Selection.FormatConditions(1).Interior.Color = RGB(255, 0, 0)
Selection.FormatConditions(1).StopIfTrue = False
End Sub