PDA

View Full Version : insert rows and paste in section from a range



SteveM99
10-14-2017, 01:57 PM
I am trying to create a macro that will insert a range starting where the active cell is located. For example a user needs to add a section where they are, they would click on the cell where they want to start and then press a macro button and a range would be inserted. I believed breaking it into two parts would make sense like inserting blank row and then copy pasting the range needed in the section but possibly insert cells can do it directly.

So if I need to insert cells into C10 to E15 from Q100 to S115 (the range I want to copy) what would code be? I need it dynamic meaning the user may be in another area so that the only thing fixed is Q100 to S115 (the range being copied). I don't want the range moved just copied in.

p45cal
10-15-2017, 10:00 AM
Supply a workbook to play with.
Q100:S115 is 16 rows, C10:E15 is 6 rows.
Do you want cells inserted (so that cells below are moved down) or just written over?
Also note that if entire sheet rows are inserted above row 100, Q100:S115 will be moved down to another address.

SteveM99
10-16-2017, 07:30 AM
thank you for sample file. file does copy paste section but it overwrites. I was looking for paste with inserting rows so rows move below. I would need move the copy from section above the row paste area so it doesn't move. see example of what I am trying to do.

p45cal
10-16-2017, 08:48 AM
tI was looking for paste with inserting rows so rows move below. But you haven't said whether you want entire rows (the width of the entire sheet) inserted or just a block of 6x4 cells inserted. The attached contains both options.

SteveM99
10-16-2017, 06:42 PM
Thank you very much for the codes. Spot on!