macro to insert copied row

JLawrenc

New Member
Joined
Sep 19, 2013
Messages
5
I have a sheet that contains a few formulas in each row. I frequently need to insert more rows up top so I copy row 2 (row one is title row) then insert it between row 2 and 3, then copy rows 2 and 3 and insert it again to add a few new rows with the formulas already entered. I'm sure I can do that with a macro but can't find how. Can I have some help?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Why not highlight rows 3-5 and insert blanks rows. Then highlight rows 2-5 and press CTRL + D to fill down row 2 into the new 3 blank rows?
 
Upvote 0
That's what I currently do, I just thought It'd be cool to learn a shortcut for that. And I'm trying to learn more about macros and what all they can do.
 
Upvote 0
From the active cell, this will insert 3 blank lines and copy the formulas down. For a nice guide on assigning a shortcut go here, Assigning Excel Macros to Objects.
Code:
Sub insert_at_activecell()
    Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(3, 0)).EntireRow.Insert
    Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(3, 0)).EntireRow.FillDown
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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