Insert New Rows And Copy Formula Automatically

nehpets12

Active Member
Joined
Feb 22, 2002
Messages
453
Just a quick question on Excel. I have created a new report which has a number of formulae in it. There will be a requirement by the Depots to insert rows. How do I set it up to the formula in the respective rows automatically is copied into the new cells when the rows are added?
 
Yes its old but i am trying to get my head around a similar problem. Could he have not just converted it to a table?
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I'm using the following code. It will insert a new row and copy the formula in Column F, O, P, Q, R, S.

Code:
Sub InsertRow_and_ColBformula()
With ActiveCell.EntireRow
.Insert
.Cells(1, 5).Copy .Cells(0, 5)
.Cells(1, 15).Copy .Cells(0, 15)
.Cells(1, 16).Copy .Cells(0, 16)
.Cells(1, 17).Copy .Cells(0, 17)
.Cells(1, 18).Copy .Cells(0, 18)
.Cells(1, 19).Copy .Cells(0, 19)
End With
End Sub

Now I would like to manually introdure a variable (with a msg box or something similar) to insert 30 or 31 row depending of the numbers of days in the month. Than add dates in a descending order in Column A of these new rows.....

Any help would be appreciate.


Another option would be to insert one row only and adding the date of the day before in Column A of the new row.


Additionnaly, I would like to modify my code above to use a determine row where to insert inlieu of using ActiveCell.
 
Last edited:
Upvote 0
I change my code to this

Code:
Sub InsertRow_TEST_with_FORMULA()
Sheets("DATA").Select
Range("A5").Select
With ActiveCell.EntireRow
.Insert
.Cells(1, 5).Copy .Cells(0, 5)
.Cells(1, 15).Copy .Cells(0, 15)
.Cells(1, 16).Copy .Cells(0, 16)
.Cells(1, 17).Copy .Cells(0, 17)
.Cells(1, 18).Copy .Cells(0, 18)
.Cells(1, 19).Copy .Cells(0, 19)
End With
End Sub

Now I would like to manually introdure a variable (with a msg box or something similar) to insert 30 or 31 row depending of the numbers of days in the month. Than add dates in a descending order in Column A of these new rows.....

Any help would be appreciate.


Another option would be to insert one row only and adding the date of the day before in Column A of the new row.
 
Upvote 0

Forum statistics

Threads
1,215,488
Messages
6,125,092
Members
449,206
Latest member
ralemanygarcia

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