Hello
Found below macro to find duplicates in single column and highlight matching values, Issue with this macro is it uses only 1 color (red) and searches for duplicates in other columns
Require below pre defined colors to be added in below macro and search for duplicates in only single column.Fil up color based on change event.
Color= 4
color=7
Color= 12
color=38
color=39
color= 40
color=46
Found below macro to find duplicates in single column and highlight matching values, Issue with this macro is it uses only 1 color (red) and searches for duplicates in other columns
Require below pre defined colors to be added in below macro and search for duplicates in only single column.Fil up color based on change event.
Color= 4
color=7
Color= 12
color=38
color=39
color= 40
color=46
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Dim cel As Range
Dim col As Range
Dim c As Range
Dim firstAddress As String
Target.Interior.ColorIndex = xlNone
For Each col In Target.Columns
Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
Debug.Print Rng.Address
For Each cel In col
If WorksheetFunction.CountIf(Rng, cel.Value) > 1 Then
Set c = Rng.Find(What:=cel.Value, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Interior.ColorIndex = 3
Set c = Rng.FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End If
Next
Next col
End Sub