View Single Post
 
Old 06-06-2017, 06:13 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
Code:
Option Explicit

  Sub Dups()  'Compares data Sheet1 & Sheet2 ... Highlights dupes on Sheet2
        Dim Rng As Range, Dn As Range
        With Sheets("Sheet1")
            Set Rng = .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp))
        End With
        With CreateObject("scripting.dictionary")
            .CompareMode = vbTextCompare
            For Each Dn In Rng
                .Item(Dn.Value & Dn.Offset(, 1).Value) = Empty
            Next
            With Sheets("Sheet2")
                Set Rng = .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp))
            End With
            For Each Dn In Rng
                If .exists(Dn.Value & Dn.Offset(, 1).Value) Then
                    'Dn.Resize(, 2).Interior.Color = vbYellow
                    Dn.Offset(0, 2).Value = "True"
                Else
                    Dn.Offset(0, 2).Value = "False"
                End If
            Next
        End With
    End Sub
Attached Files
File Type: xlsm Dupes Find and Mark 2 Sheets.xlsm (18.7 KB, 11 views)
Reply With Quote