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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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