madhuchelliah
Board Regular
- Joined
- Nov 22, 2017
- Messages
- 226
- Office Version
- 2019
- Platform
- Windows
Hello All, i have two tables in sheet1 and sheet2. I want to copy the row from sheet2 table and insert in sheet1 table. Please go through the example for better clarity.
VBA has to copy the rows with same value in sheet2 B column and stack the rows under the same value in sheet1 B column wherever the values are exists.
Consider the range as dynamic in both sheets. Thank you.
Result:
Rows inserted from sheet2 are highlighted
VBA has to copy the rows with same value in sheet2 B column and stack the rows under the same value in sheet1 B column wherever the values are exists.
Consider the range as dynamic in both sheets. Thank you.
Book1 | |||||
---|---|---|---|---|---|
B | C | D | |||
2 | Book | Sold | Onsale | ||
3 | Book | In stock | Out of Stock | ||
4 | AAA | AAA | AAA | ||
5 | BBB | BBB | BBB | ||
6 | CCC | CCC | CCC | ||
7 | DDD | DDD | DDD | ||
8 | EEE | EEE | EEE | ||
9 | Book | Sold | Onsale | ||
10 | Book | In stock | Out of Stock | ||
11 | FFF | FFF | FFF | ||
12 | GGG | GGG | GGG | ||
13 | HHH | HHH | HHH | ||
14 | Book | Sold | Onsale | ||
15 | FFF | FFF | FFF | ||
16 | GGG | GGG | GGG | ||
17 | HHH | HHH | HHH | ||
Sheet1 |
Book1 | |||||
---|---|---|---|---|---|
B | C | D | |||
2 | Book | Author | Publisher | ||
3 | Book | First Edition | Reprint | ||
4 | AAA | 0 | 0 | ||
5 | AAA | 111 | 111 | ||
6 | BBB | 112 | 112 | ||
7 | CCC | 113 | 113 | ||
8 | DDD | 114 | 114 | ||
9 | EEE | 115 | 115 | ||
10 | FFF | 116 | 116 | ||
11 | GGG | 117 | 117 | ||
12 | HHH | 118 | 118 | ||
Sheet2 |
Result:
Rows inserted from sheet2 are highlighted
Book1 | |||||
---|---|---|---|---|---|
B | C | D | |||
2 | Book | Sold | Onsale | ||
3 | Book | In stock | Out of Stock | ||
4 | Book | Author | Publisher | ||
5 | Book | First Edition | Reprint | ||
6 | AAA | AAA | AAA | ||
7 | AAA | 0 | 0 | ||
8 | AAA | 111 | 111 | ||
9 | BBB | BBB | BBB | ||
10 | BBB | 112 | 112 | ||
11 | CCC | CCC | CCC | ||
12 | CCC | 113 | 113 | ||
13 | DDD | DDD | DDD | ||
14 | DDD | 114 | 114 | ||
15 | EEE | EEE | EEE | ||
16 | EEE | 115 | 115 | ||
17 | Book | Sold | Onsale | ||
18 | Book | In stock | Out of Stock | ||
19 | Book | Author | Publisher | ||
20 | Book | First Edition | Reprint | ||
21 | FFF | FFF | FFF | ||
22 | FFF | 116 | 116 | ||
23 | GGG | GGG | GGG | ||
24 | GGG | 117 | 117 | ||
25 | HHH | HHH | HHH | ||
26 | HHH | 118 | 118 | ||
27 | Book | Sold | Onsale | ||
28 | Book | Author | Publisher | ||
29 | Book | First Edition | Reprint | ||
30 | FFF | FFF | FFF | ||
31 | FFF | 116 | 116 | ||
32 | GGG | GGG | GGG | ||
33 | GGG | 117 | 117 | ||
34 | HHH | HHH | HHH | ||
35 | HHH | 118 | 118 | ||
Sheet1 |