Auto sum, Insert row, the row not included in sum statement

Jo Helge Rorvik

New Member
Joined
Mar 23, 2023
Messages
11
Office Version
  1. 365
I have a Range(D4:D4) which I want to expand with adding a new row at the first position in range -> Row(4)
At he bottom in Row(5) I have a summation Relative: '=SUM(R4C:R[-1]C)'
The row I have do not have any data its just a formatting row with Date and Text and Currency among others
I wanted to add a new row and use the current row(4) as a template for the content added.
I just used the macro recorder and got this code:
Rows("4:4").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
The template worked fine, and formatting is copied, but
when I look in my summary cell, the formula has changed Relative: '=SUM(R5C:R[-1]C)'
gone to row 5, I still want it to start at 4

Is there a solution to include the inserted row??

Thanks for any solution
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi I found a solution to this problem
1. Created a Start row with the formatting as already mentioned
2. Created a end row with formatting as the first row.
3. Made both of theese rows hidden
4. The reason for this is to make limits, both in top and bottom
5. The =SUM(startRow:endRow)-> =SUM(R4C:R[-1]C)
6. Now I can add entries and delete entries of visible rows without conserns about start and end limits
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,277
Members
452,902
Latest member
Knuddeluff

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