Hi, Can someone help me with a VBA code for the below I tried but couldn't get at anything that works. Thank you inadvance.
below is sample data list which is present in sheet1.
Name1 - Column A | Name2 - Column B |
A | |
A | 1 |
A | 2 |
A | 3 |
A | 4 |
B | |
B | 3 |
B | 2 |
B | 4 |
C | |
C | 5 |
C | 6 |
Grand Total |
below is sample data list which is present in sheet2.
Name1 - Column A | Name2 - Column B |
A | |
A | 1 |
A | 2 |
A | 3 |
A | 4 |
B | |
B | 3 |
B | 2 |
B | 1 |
B | 4 |
C | |
C | 5 |
C | 6 |
D | |
D | 7 |
Grand Total |
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). (any new data will be present in sheet2 hence that needs to be added to sheet1)
then it has to compare combnation of colum A and Column B data in the both sheets 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.).
below is the expected output that wil be present in sheet1.
Name1 - Column A | Name2 - Column B |
A | |
A | 1 |
A | 2 |
A | 3 |
A | 4 |
B | |
B | 3 |
B | 2 |
B | 4 |
B | 1 |
C | |
C | 5 |
C | 6 |
D | |
D | 7 |
Grand Total |