Consulting

Results 1 to 3 of 3

Thread: Need Help restructuriing Macro that highlights dups to highlight also partial

  1. #1
    VBAX Mentor
    Joined
    Feb 2016
    Posts
    382
    Location

    Need Help restructuriing Macro that highlights dups to highlight also partial

    I have Data in Column G in the form of combinations.
    I need the Duplicate Macro to be restuctured to not only highlight the exact matches in column K but also to highlight the the data with at least 3 matching numbers within the combination, and four matching as well.

    so for example G1 matches the data in K6 cause all 5 numbers match both would be highlighted.

    in G2 with macro restuctured it would highlight it as it would match four of the numbers in K2 the 4-5-8-10

    in the next example G10 the numbers 8-10-13 match the numbers in K9 cause the numbers 8-10-13 match.

    Additional info.
    the macro would start at at G1 highlight all matching based in the above description.
    then it would continue to G2 and continue highlighting, Keep in mind once the data in column G and K is highlighted as the macro goes down the column anything highlighted will not be cleared, the ones allready highlighted will be skipped over as it is allready been highlighted.

    Any Help on this is Appreciated!
    Thank you in Advance

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
     Option Explicit
    
    Sub test()
        Dim g As Range, k As Range
        Dim s, e
    
        For Each g In Range("g1", Range("g1").End(xlDown))
            For Each k In Range("k1", Range("k1").End(xlDown))
                s = Split(g.Value, "-")
                For Each e In Split(k.Value, "-")
                    s = Filter(s, e, False)
                Next
                If UBound(s) < 2 Then
                    Union(g, k).Interior.Color = vbRed
                End If
            Next
        Next
        
    End Sub
    Last edited by mana; 03-04-2017 at 10:59 PM.

  3. #3
    VBAX Mentor
    Joined
    Feb 2016
    Posts
    382
    Location
    Great job!!!!!!! Thank you Very Much!!!!!!

Posting Permissions

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