* Question for Sum formula in Macro *

brad7989

New Member
Joined
Aug 1, 2011
Messages
45
I have data that comes in at variable lengths in terms of rows and want to have the macro insert a Totals row. The problem I have though is I can't get the sum formula to start from the top and go down through the bottom.

If you can help me with this, I'd greatly appreciate it!

Thanks!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Where will the sum formula be placed on the sheet?
Is row 1 a row for headers?
 
Upvote 0
Where will the sum formula be placed on the sheet?
Is row 1 a row for headers?


The sum formula will be paced at the bottom of the data list with one blank row separating the data from the sum cells.

Row 1-5 will be headers and the data will begin on row 6. That will be the same every time - it's just the lower end that will change.
 
Upvote 0
For instance:

Code:
Sub putformula()
   Range("A" & Rows.Count).End(xlUp).Offset(2).Formula = "=SUBTOTAL(109,R6C:R[-2]C)"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

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