How to automatically make copies of rows in Excel? -
i have excel file looks this:
row1_cell1 row1_cell2 row1_cell3
row2_cell1 row2_cell2 row2_cell3
row3_cell1 row3_cell2 row3_cell3
how can make 3 (or number of) copies of each row have in sheet, added after row being copied? so, in end have kind of result:
row1_cell1 row1_cell2 row1_cell3
row1_cell1 row1_cell2 row1_cell3
row1_cell1 row1_cell2 row1_cell3
row2_cell1 row2_cell2 row2_cell3
row2_cell1 row2_cell2 row2_cell3
row2_cell1 row2_cell2 row2_cell3
row3_cell1 row3_cell2 row3_cell3
row3_cell1 row3_cell2 row3_cell3
row3_cell1 row3_cell2 row3_cell3
this how rows on sheet:
option explicit sub multiplyrows() dim rwscnt long, lr long, insrw long rwscnt = application.inputbox("how many copies of each row should inserted?", "insert count", 2, type:=1) if rwscnt = 0 exit sub lr = range("a" & rows.count).end(xlup).row application.screenupdating = false insrw = lr 1 step -1 rows(insrw).copy rows(insrw + 1).resize(rwscnt).insert xlshiftdown next insrw application.screenupdating = true end sub
Comments
Post a Comment