Sub HighlightUniqueDuplicatesGC()
Dim sh As Worksheet, c As Range, clr As Variant, lr As Long
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 6).End(xlUp).Row
clr = Array(3, 4, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 26, 27, 28, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 53, 54)
With sh
.Range("F1:F" & lr).AdvancedFilter xlFilterCopy, , .Range("EE" & lr + 2), True
x = LBound(clr)
For Each c In .Range("EE" & lr + 4).CurrentRegion
.UsedRange.AutoFilter 1, c.Value
If Application.CountIf(.Range("F:F"), c.Value) > 1 Then
.Range("F2", .Cells(Rows.Count, 6).End(xlUp)).SpecialCells(xlCellTypeVisible).EntireRow.Interior.ColorIndex = clr(x)
End If
.AutoFilterMode = False
x = x + 1
If x > UBound(clr) Then x = LBound(clr)
Next
.Range("EE" & lr + 2).CurrentRegion.Delete
End With
End Sub
"To answer your question, this is useful as we are merging two data sets from different MCOs which share services and part numbers. We need to easily identify where a service and part number repeated for audit purposes."
Bookmarks