I have code that High Lights Duplicates in a Workbook. Out of the 12 sheets only 7, I want to find dup's. All 7 are formatted as Table's and are identical. It also high lights the tab when one is found. It works perfect but I cant figure out how to exclude 4 of the sheets. Columns are A - T and it searches through B .
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim ws As Worksheet, Dn As Range, Q As Variant
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Tab.ColorIndex = xlColorIndexNone '<<<
ws.Range("B2:B106").Interior.ColorIndex = xlNone
For Each Dn In ws.Range("B2:B106")
If Dn.Value <> "" Then
If Not .exists(Dn.Value) Then
.Add Dn.Value, Array(Dn, ws)
Else
Q = .Item(Dn.Value)
Q(0).Interior.Color = vbRed
Dn.Interior.Color = vbRed
ws.Tab.Color = 225
Q(1).Tab.Color = 225
.Item(Dn.Value) = Q
End If
End If
Next Dn
Next ws
Application.ScreenUpdating = True '<<<
End With
End Sub
Last edited by a moderator: