Hi all,
I am trying to compare two sheets and copy the new data from 1 to another if its not there, this code only seems to copy the first 2 columns.
What do I need to change to include up to column I? Also is there a way to copy them to Compare sheet with a different colour to see what has been added?
Thank you
I am trying to compare two sheets and copy the new data from 1 to another if its not there, this code only seems to copy the first 2 columns.
What do I need to change to include up to column I? Also is there a way to copy them to Compare sheet with a different colour to see what has been added?
VBA Code:
Sub Compare()
Dim Ary As Variant
Dim i As Long, j As Long
Ary = Sheets("RECP1").Range("A1").CurrentRegion.Value2
With Sheets("Compare")
j = .Range("A" & Rows.Count).End(xlUp).Row
For i = UBound(Ary) To 2 Step -1
If .Cells(j, 1).Value = Ary(i, 1) Then
j = j - 1
Else
Rows(j + 1).Insert
.Cells(j + 1, 1).Resize(, 2).Value = Array(Ary(i, 1), Ary(i, 2))
End If
Next i
End With
End Sub
Thank you