Compare and update excel sheet [Closed]

Report
-
 ujo -
Hello,
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
Regards
Ujwal

2 replies

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
792
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
Else
GoTo line2
End If
End With
line1:
'MsgBox c1.Value c1.EntireRow.Copy
With Worksheets("sheet2")
.Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial
End With
line2:
Next c1
End With
Application.CutCopyMode = False

End Sub

3
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Hey venkat this is simply great ..

thanks a ton

Ujo

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!