View Single Post
 
Old 06-07-2017, 01:31 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit 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("Sheet2")
            Set Rng = .Range(.Range("C2"), .Range("C" & 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("Sheet1")
                Set Rng = .Range(.Range("A2"), .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, 1).Value = "True"
                Else
                    Dn.Offset(0, 1).Value = "False"
                End If
            Next
        End With
    End Sub
Attached Files
File Type: xlsm ID_Files.xlsm (24.1 KB, 9 views)
Reply With Quote