VBA code to compare two lists and update

Wafee

Board Regular
Joined
May 27, 2020
Messages
104
Office Version
  1. 2013
Platform
  1. Windows
Hi, Can someone help mw with a VBA code for the below.

below is my input list

Book3
AB
1Name1Name2
2A
3A1
4A2
5A3
6A4
7B
8B1
9B3
10B2
11B4
12C
13C5
14C6
15D
16D7
17Grandtotal
Sheet2


and this is my output list.

Book3
AB
1Name1Name2
2A
3A1
4A2
5A3
6A4
7B
8B3
9B2
10B4
11C
12C5
13C6
14Grandtotal
Sheet1



this is my expected output.

Book3
AB
1Name1Name2
2A
3A1
4A2
5A3
6A4
7B
8B3
9B2
10B4
11B1
12C
13C5
14C6
15D
16D7
17Grandtotal
Sheet2


code has to compare column A data from both sheets and if anything new is found then that needs to be added above the grand total in column A (In this case it is name D)
then it has to compare combnation of colum A and Column B and if any combination is not present then that needs to added below the last occurance of respective name1 row.(In this case we have B-1 which is not present in the output and has been added to 11th row as 10th row is last occurnce of B. similarly D-7 has been added to 16th row.).

thank you in advance.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top