Compare colomns in to Sheets and Paste Difference

Plukey

Board Regular
Joined
Apr 19, 2019
Messages
138
Office Version
  1. 2016
Platform
  1. Windows
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:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top