Hi everyone. I need to add a new blank line between the selected rows for the project plan. Almost every cell has formulas, and this new line must be the same. How can I handle without mess?
Test this on a copy of your worksheet - new row created in row below the active cell
With the cursor in G5
- inserts new row in row 6
- formulas and formats copied from row5 to row 6
Put in a standard code module
Code:
Sub InsertRowBelowActiveCell()
Dim rng As Range, cel As Range
Set cel = ActiveCell
With cel
Set rng = .EntireRow.SpecialCells(xlCellTypeFormulas)
.Offset(1).EntireRow.Insert Shift:=xlDown
.EntireRow.Copy
.Offset(1).EntireRow.PasteSpecial xlPasteFormats
rng.Copy rng.Offset(1)
End With
Application.CutCopyMode = False
End Sub
I have no idea what will happen with your merged cells - test and see if it works.
Merged cells may cause problems that cannot be easily resolved - including code refusing to run.
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.