Help on VBA for inserting a row

frank850102

New Member
Joined
Jan 26, 2010
Messages
7
Dear all

I have a spreadsheet that I need to insert rows anywhere in the model quite often. I find it quite frastrating that every time I insert a row, I have to copy the formulas down from the rows above.

Is there a way to write a VBA code that every time I insert a row, all the formulas above can be directly copied down, but the cells that require manual input do not get copied? in another word, keep the cells requiring manual input blank.

Thank you very much!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try this before using VBA
Highlight the row at the header and right click
Select copy
Now Highlight the row below and right click again
Select Insert copied cells.
Everything will now be copied, including the formulae
 
Upvote 0
Try this before using VBA
Highlight the row at the header and right click
Select copy
Now Highlight the row below and right click again
Select Insert copied cells.
Everything will now be copied, including the formulae

Could you please write a VBA code for this process?
 
Upvote 0
Sorry Frank....Had to go and play golf !!!
try
Code:
Sub InsertRow()
Dim rowz As Range
Set rowz = Application.InputBox("Select a cell to add a row", Title:="Add a row", Type:=8)
    rowz.EntireRow.Copy
    rowz.EntireRow.Insert
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,949
Latest member
Dupuhini

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