I'm created a VBA to copy data from sheet "Sheet1", Range A2:C to sheet "Sheet2", Range A23:C. I'm looking to add the functionality of updating existing values and inserting new values at the bottom.I like to copy from one sheet to another sheet. When copying from one sheet to another . I like to compare with first two cells of each row ( "Job" & "Operation" ). If they are same , they need to replace them with new data from other sheet . when they do not have a match , a new content will be placed at bottom of the existing table

Sub Operation()

Dim ws As Worksheet, ws1 As Worksheet
Dim lastrow As Long
Set ws = Sheets("Worksheet1")
Set ws1 = Sheets("Worksheet2")

lastrow = ws.Cells(Rows.count, 4).End(xlUp).Row
ws.Range("A2:C" & lastrow).Copy
ws1.Range("A23:C").PasteSpecial xlPasteValues
ws1.Activate

End Sub

Worksheet 1


Job Operation Fruit
1 ab Apple
1 cd Orange
2 ef Apple
2 rf Grapes
3 fg Apple
4 gh Mango
4 bg Apple
5 gb Grapes

Worksheet 2
Job Operation Fruit
1 ab Apple
1 cd Orange
2 ef Apple
2 rf Grapes
3 fg Apple
4 gh Mango
4 bg Apple
5 gb Grapes


I have got

Job Operation Fruit
1 ad Apple
1 cd Mango
2 ef Apple
2 rf Grapes
2 rr Apple
4 gh Banana
4 bg Apple
5 gb Grapes
1 ab Apple
1 cd Orange
2 ef Apple
2 rf Grapes
3 fg Apple
4 gh Mango
4 bg Apple
5 gb Grapes



I expect the following results

Job Operation Fruit
1 ad Apple
1 cd Orange
1 ab Apple
2 ef Apple
2 rf Grapes
2 rr Apple
3 fg Apple
4 gh Mango
4 bg Apple
5 gb Grapes