PDA

View Full Version : Compare Sheet1 and Sheet2 Results in Sheet3



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

Aussiebear
05-21-2008, 08:27 AM
Hi Bootney, Welcome to vbax. What appears to be the issue?

grichey
05-21-2008, 08:36 AM
Looks like your current code is just putting the cells in sheet 1 in sheet 3 that do not have a match anywhere in sheet 3 regardless of position.