VBA/Macro to highlight duplicates from multiple columns on several worksheets.
I need a VBA/Macro to highlight all duplicate numbers. The problem is there are three columns within each worksheet that need selected with an addition of 12 separate worksheets.
In the attached workbook all the information I left in each column to needs to be connected to show if a duplicate entry in listed in any of the columns on any of the worksheets.
You must first remove any conditional formatting in all PALLET columns
before executing this starter demonstration which turns duplicates to bold :
PHP Code:
Sub Demo1() Const D = "¤" Dim Ws As Worksheet, Li As ListObject, V, S$, Rg As Range With CreateObject("Scripting.Dictionary") For Each Ws In Worksheets For Each Li In Ws.ListObjects If Li.ListRows.Count Then V = Application.Match("PALLET", Li.HeaderRowRange, 0) If IsNumeric(V) Then S = S & IIf(S > "", D, "") & Li.DataBodyRange.Columns(V).Address(External:=True) For Each V In Li.DataBodyRange.Columns(V).Value2: .Item(V) = .Item(V) + 1: Next End If End If Next Li, Ws Application.ScreenUpdating = False For Each V In Split(S, D) Range(V).Font.Bold = False For Each Rg In Range(V) If .Item(Rg.Value2) > 1 Then Rg.Font.Bold = True Next Rg, V Application.ScreenUpdating = True .RemoveAll End With End Sub
► Do you like it ? ► ► So thanks to click on bottom left star icon « ★ Add Reputation » !
Bookmarks