Hello,
I need a macro to duplicate rows depending on the number in row D.
Here is an example of how it looks before:
And after:
Note that there are more cells in the other columns (J through BI), so the whole row needs to be copied.
Column D should be - 0, 1, 2, 0, 1, 2, etc
Each row should be duplicated so it exists three times (0 1 and 2). Note that some rows are already duplicated once, some have not.
Thanks
Matt
I need a macro to duplicate rows depending on the number in row D.
Here is an example of how it looks before:
Excel Workbook | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | 2592 | FK90AI2INV | 0 | 0 | F90AIINV.jpg | F90AIINV.jpg | F90AIINV.jpg | R90AI2KB.jpg | R90AI2KB.jpg | ||
2 | 2592 | FK90AI2INV | 0 | 1 | F90AIINV.jpg | F90AIINV.jpg | F90AIINV.jpg | R90AI2KB.jpg | R90AI2KB.jpg | ||
3 | 2593 | F90AIINV | 0 | 0 | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | ||||
4 | 2593 | F90AIINV | 0 | 1 | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | ||||
5 | 2594 | R90AI2KB | 0 | 0 | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | ||||
6 | 2595 | SS90AI2KB | 0 | 0 | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | ||||
Sheet1 |
And after:
Excel Workbook | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | 2592 | FK90AI2INV | 0 | 0 | F90AIINV.jpg | F90AIINV.jpg | F90AIINV.jpg | R90AI2KB.jpg | R90AI2KB.jpg | ||
2 | 2592 | FK90AI2INV | 0 | 1 | F90AIINV.jpg | F90AIINV.jpg | F90AIINV.jpg | R90AI2KB.jpg | R90AI2KB.jpg | ||
3 | 2592 | FK90AI2INV | 0 | 2 | F90AIINV.jpg | F90AIINV.jpg | F90AIINV.jpg | R90AI2KB.jpg | R90AI2KB.jpg | ||
4 | 2593 | F90AIINV | 0 | 0 | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | ||||
5 | 2593 | F90AIINV | 0 | 1 | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | ||||
6 | 2593 | F90AIINV | 0 | 2 | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | vfiber/F90AIINV.jpg | ||||
7 | 2594 | R90AI2KB | 0 | 0 | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | ||||
8 | 2594 | R90AI2KB | 0 | 1 | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | ||||
9 | 2594 | R90AI2KB | 0 | 2 | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | vfiber/R90AI2KB.jpg | ||||
10 | 2595 | SS90AI2KB | 0 | 0 | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | ||||
11 | 2595 | SS90AI2KB | 0 | 1 | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | ||||
12 | 2595 | SS90AI2KB | 0 | 2 | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | vfiber/SS90AI2KB.jpg | ||||
Sheet1 |
Note that there are more cells in the other columns (J through BI), so the whole row needs to be copied.
Column D should be - 0, 1, 2, 0, 1, 2, etc
Each row should be duplicated so it exists three times (0 1 and 2). Note that some rows are already duplicated once, some have not.
Thanks
Matt