Looking for a little help. I need a way to compare a list on one sheet (A), Column A; with a list of values on another sheet (COMPARE), Column A.
If the value is missing from the list on Sheet (COMPARE), it copies the value to the bottom of the list on Sheet (A) along with the values of the two adjacent columns on Sheet (COMPARE).
I have found a VBA that will do the comparison and add the missing value to the end of the list but I do not know how to copy the adjacent column data over. I am by far not a VBA expert. My VBA code is below. Thanks in advance.
Sub x()
Dim r1 As Excel.Range
Dim r2 As Excel.Range
Dim r3 As Excel.Range
Dim c As Excel.Range
Dim x As Date
Set r1 = Range("A1").Resize(Range("A" & Rows.Count).End(xlUp).Row)
Set r2 = Worksheets("Compare").Range("A2").Resize(Worksheets("Compare").Range("A" & Rows.Count).End(xlUp).Row)
x = Now
For Each c In r2
Set r3 = r1.Find(What:=c.Value, MatchCase:=False, Lookat:=xlWhole)
If r3 Is Nothing Then
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = c.Value
End If
Next
Debug.Print DateDiff("s", x, Now)
End Sub
If the value is missing from the list on Sheet (COMPARE), it copies the value to the bottom of the list on Sheet (A) along with the values of the two adjacent columns on Sheet (COMPARE).
I have found a VBA that will do the comparison and add the missing value to the end of the list but I do not know how to copy the adjacent column data over. I am by far not a VBA expert. My VBA code is below. Thanks in advance.
Sub x()
Dim r1 As Excel.Range
Dim r2 As Excel.Range
Dim r3 As Excel.Range
Dim c As Excel.Range
Dim x As Date
Set r1 = Range("A1").Resize(Range("A" & Rows.Count).End(xlUp).Row)
Set r2 = Worksheets("Compare").Range("A2").Resize(Worksheets("Compare").Range("A" & Rows.Count).End(xlUp).Row)
x = Now
For Each c In r2
Set r3 = r1.Find(What:=c.Value, MatchCase:=False, Lookat:=xlWhole)
If r3 Is Nothing Then
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = c.Value
End If
Next
Debug.Print DateDiff("s", x, Now)
End Sub