+ Reply to Thread
Results 1 to 3 of 3

VBA/Macro to highlight duplicates from multiple columns on several worksheets.

  1. #1
    Registered User
    Join Date
    01-10-2020
    Location
    U.S.
    MS-Off Ver
    2013
    Posts
    4

    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.

    Thanks
    Attached Files Attached Files
    Last edited by DrewL4; 01-10-2020 at 03:08 PM.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool

    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 
    "¤"
                 
    Dim Ws As WorksheetLi As ListObjectVS$, 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.HeaderRowRange0)
                    If 
    IsNumeric(VThen
                        S 
    IIf(""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 LiWs
                Application
    .ScreenUpdating False
            
    For Each V In Split(SD)
                
    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 » !

  3. #3
    Registered User
    Join Date
    01-10-2020
    Location
    U.S.
    MS-Off Ver
    2013
    Posts
    4

    Re: VBA/Macro to highlight duplicates from multiple columns on several worksheets.

    It worked great on the example that I had attached. When running it in the actual worksheet its giving me an error on line.....

    For Each V In Li.DataBodyRange.Columns(V).Value2

    Also, can you set this up to run every time the worksheet is opened.

    Thanks again so much.
    Last edited by DrewL4; 01-13-2020 at 01:10 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] highlight duplicates across multiple worksheets
    By bqheng in forum Excel General
    Replies: 9
    Last Post: 04-13-2017, 12:07 AM
  2. Highlight duplicates, multiple columns
    By ChrisLN in forum Excel General
    Replies: 2
    Last Post: 11-04-2016, 05:57 AM
  3. [SOLVED] VBA To Highlight Duplicates against a Master list across multiple columns
    By Bagpuss1234 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-08-2015, 11:22 AM
  4. [SOLVED] Highlight Duplicates Between Multiple Columns
    By WorkwearExp in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-10-2014, 08:12 AM
  5. Macro To Compare Multiple Excel sheets and highlight duplicates
    By Rey123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2013, 05:07 AM
  6. [SOLVED] Help Needed- Excel macro to compare two columns in two worksheets and highlight duplicates
    By advent in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-10-2013, 05:17 PM
  7. Replies: 5
    Last Post: 07-05-2011, 06:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1