VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
Dim ws As Worksheet
Dim ColorRng As Range
Dim ColorCell As Range
Set ws = Worksheets("invdatabase")
Set ColorRng = ws.Range("B2", "H10000")
For Each ColorCell In ColorRng
If WorksheetFunction.CountIf(ColorRng, ColorCell.Value) > 1 Then
ColorCell.Interior.Color = RGB(255, 153, 0)
ColorCell.Font.Color = vbBlack
Else
ColorCell.Interior.ColorIndex = 1
ColorCell.Font.Color = vbWhite
End If
Next
ActiveSheet.Protect
End Sub
these codes find duplicate in column B only, But I need to assign multiple columns like b or c or anyone and it should search duplicate and highlight in its individual column.