Duplicate Rows Conitionally

Gamermatt

Board Regular
Joined
May 14, 2009
Messages
186
Hello,

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
ABCDEFGHI
12592FK90AI2INV00F90AIINV.jpgF90AIINV.jpgF90AIINV.jpgR90AI2KB.jpgR90AI2KB.jpg
22592FK90AI2INV01F90AIINV.jpgF90AIINV.jpgF90AIINV.jpgR90AI2KB.jpgR90AI2KB.jpg
32593F90AIINV00vfiber/F90AIINV.jpgvfiber/F90AIINV.jpgvfiber/F90AIINV.jpg
42593F90AIINV01vfiber/F90AIINV.jpgvfiber/F90AIINV.jpgvfiber/F90AIINV.jpg
52594R90AI2KB00vfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpg
62595SS90AI2KB00vfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpg
Sheet1



And after:


Excel Workbook
ABCDEFGHI
12592FK90AI2INV00F90AIINV.jpgF90AIINV.jpgF90AIINV.jpgR90AI2KB.jpgR90AI2KB.jpg
22592FK90AI2INV01F90AIINV.jpgF90AIINV.jpgF90AIINV.jpgR90AI2KB.jpgR90AI2KB.jpg
32592FK90AI2INV02F90AIINV.jpgF90AIINV.jpgF90AIINV.jpgR90AI2KB.jpgR90AI2KB.jpg
42593F90AIINV00vfiber/F90AIINV.jpgvfiber/F90AIINV.jpgvfiber/F90AIINV.jpg
52593F90AIINV01vfiber/F90AIINV.jpgvfiber/F90AIINV.jpgvfiber/F90AIINV.jpg
62593F90AIINV02vfiber/F90AIINV.jpgvfiber/F90AIINV.jpgvfiber/F90AIINV.jpg
72594R90AI2KB00vfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpg
82594R90AI2KB01vfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpg
92594R90AI2KB02vfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpgvfiber/R90AI2KB.jpg
102595SS90AI2KB00vfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpg
112595SS90AI2KB01vfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpg
122595SS90AI2KB02vfiber/SS90AI2KB.jpgvfiber/SS90AI2KB.jpgvfiber/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
 

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,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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