Bootney
05-21-2008, 06:58 AM
Sub Compare_Sheet1_with_Sheet2_Results_in_Sheet3()
Dim row_index As Double
On Error Resume Next
For row_index = 2 To 130
If IsError(Application.WorksheetFunction.Vlookup(Sheets("Sheet1").Range("A" & row_index).Value, Sheets("Sheet2").Range("A2:L128"), 1, False)) Then
Sheets("Sheet1").Range("A" & row_index).EntireRow.Copy Destination:=Sheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next row_index
End Sub
It compares Sheet1 with Sheet2 and gives results to sheet3.
Using Vlookup Worksheet Function.
Edited by Aussiebear to wrap code in tags
Dim row_index As Double
On Error Resume Next
For row_index = 2 To 130
If IsError(Application.WorksheetFunction.Vlookup(Sheets("Sheet1").Range("A" & row_index).Value, Sheets("Sheet2").Range("A2:L128"), 1, False)) Then
Sheets("Sheet1").Range("A" & row_index).EntireRow.Copy Destination:=Sheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next row_index
End Sub
It compares Sheet1 with Sheet2 and gives results to sheet3.
Using Vlookup Worksheet Function.
Edited by Aussiebear to wrap code in tags