I am using the conditional formatting to highlight duplicate values. Then I want to check for all the highlighted cells and count the duplicates (dividing by 2). The conditional formatting records the interior color used to highlight is 13551615, but it doesn't recognize that the highlighted cells are this color later.
To highlight duplicates
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).DupeUnique = xlDuplicate
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
To count highlighted cells
Sub Dup_Check2()
Dim RowsEnd As Integer
RowsEnd = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To RowsEnd
If Cells(i, 1).Interior.Color = 13551615 Then
Duplicate_Count = Duplicate_Count + 1
End If
Next
End Sub
Bookmarks