VBA - insert new row Y, copy row X and paste format and formulas in row Y

emma1234

New Member
Joined
May 2, 2019
Messages
4
Hello
Sorry this could be really simple but I've spent hours and feel like I'm going round in circles! Any help would be really appreciated.

I want a macro to insert a new row below the current active cell, then copy and paste format and formula from row 8 into that new row. I have been trying the below;

Sub Insert_Row()


ActiveCell.EntireRow.Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("8:8").Select
Selection.Copy
ActiveCell.EntireRow.Select
ActiveSheet.Paste

End Sub

When I do it though, it inserts the new row but not the formulas. It also ends with highlighting row 8 - I want it to either highlight all the new row, or just the B cell in the newly created row.

Please help!

Thanks
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this

Code:
Sub Insert_Row()
    ActiveCell.EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Rows("8:8").Copy Range("A" & ActiveCell.Row)
End Sub
 
Upvote 0
Thanks so much for coming back to me. I've tried your suggestion but it's not pasting the formulas still - any other ideas?
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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