Results 1 to 1 of 1

Thread: Compare colomns in to Sheets and Paste Difference
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Apr 2019
    Posts
    32
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Compare colomns in to Sheets and Paste Difference

    I'm using a current code to paste differences results it works perfect, but it only paste single column of non matches ...But, I need it to paste entire row. In reality Id like it to compare two columns G & H separately if possible, in both sheets, right now, ive just added the two together in a helper column..
    Code:
    Sub FindDifferences()
        Dim i As Long, ii As Long, sq1 As Variant, sq2 As Variant, m As Long
    
        sq1 = Sheet2.Cells(1).CurrentRegion.Columns(1)
        sq2 = Sheet14.Cells(1).CurrentRegion.Columns(1)
    
        Sheet3.Columns(1).ClearContents
    
        For i = 1 To UBound(sq1)
            ii = 0
            On Error Resume Next
            ii = Application.Match(sq1(i, 1), sq2, 0)
            On Error GoTo 0
            If ii = 0 Then
                m = m + 1
                Sheet3.Cells(m, 1).Value = sq1(i, 1)
            End If
        Next
    
        For i = 1 To UBound(sq2)
            ii = 0
            On Error Resume Next
            ii = Application.Match(sq2(i, 1), sq1, 0)
            On Error GoTo 0
            If ii = 0 Then
                m = m + 1
                Sheet3.Cells(m, 1).Value = sq2(i, 1)
            End If
        Next
    
    End Sub
    Last edited by Plukey; May 16th, 2019 at 11:45 AM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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