Compare and update excel sheet

ujo - Jul 15, 2009 at 11:56 PM
 ujo - Jul 16, 2009 at 06:38 AM
I have got two excel sheets one master sheet that gets updated everymonth with the new employees joining that month. the other excel sheet needs to pull the data i.e names of employees only who are not existing in it. ie new entries from the master sheet needs to be updated in the later sheet. Please help

2 replies

venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 810
Jul 16, 2009 at 05:53 AM
sheet 1 is master sheet and sheet 2 is the other sheet .

modify the macro to suit your

Sub test()

Dim rng1 As Range, c1 As Range, cfind As Range, x As String
On Error Resume Next
With Worksheets("sheet1")
Set rng1 = Range(.Range("a2"), .Range("a2").End(xlDown))
For Each c1 In rng1
x = c1.Value
'MsgBox x
With Worksheets("sheet2").Columns("A:A")
Set cfind = .Cells.Find(what:=x, lookat:=xlWhole)
If cfind Is Nothing Then
GoTo line1
GoTo line2
End If
End With
'MsgBox c1.Value c1.EntireRow.Copy
With Worksheets("sheet2")
.Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial
End With
Next c1
End With
Application.CutCopyMode = False

End Sub

Hey venkat this is simply great ..

thanks a ton