Macro to do Auto-sum on a range

Gregs

Board Regular
Joined
Sep 6, 2002
Messages
96
Hi, I need a macro to do an auto-sum formula at the bottom of a range of data. You will see in the attached spreadsheet, I need a formula in columns C to J. i need the macro to automatically create an auto-sum formula in next row following the data and it needs to be created in columns C to J.

THANKS FOR HELP!!
ATB - 7 Buckets Report_150503.xls
ABCDEFGHIJ
669731803Customer19.089.08000000
669831811Customer2278.91223.8842.4412.590000
669931817Customer3208.4469.4869.4869.480000
670015339Customer460.4560.45000000
670131825Customer51,811.40000001,811.400
670233309Customer69.089.08000000
670331827Customer744.6822.4422.440-0.2000
670431829Customer862.57156.570-940000
670531833Customer927.2427.24000000
67068197Customer109.139.13000000
670733182Customer11-90.739.0800-99.81000
670831873Customer12108.900000108.90
670931875Customer1382.280082.280000
671031893Customer14-30.227.03000-57.2300
671115649Customer1584.5184.51000000
671215517Customer16126.9522.8875.039.689.6809.680
6713Customer17-10,192.040-4,360.11-3,129.70-2,410.16-220.4-71.670
6714REQUIREAMACROTOCREATEANAUTO-SUMFORMULAHEREFORTHEDATAABOVE
sheet1
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try this:

Code:
Sub Test()
    Dim Rng As Range
    Dim c As Range
    Set Rng = Range("C1:C" & Range("C1").End(xlDown).Row)
    Set c = Range("C1").End(xlDown).Offset(1, 0)
    c.Formula = "=SUM(" & Rng.Address(False, False) & ")"
    c.Copy c.Resize(1, 8)
End Sub
 
Upvote 0
Or :-

With [C1].End(xlDown)(2).Resize(, 8)
.FormulaR1C1 = "=SUM(R[-" & .Row - 1 & "]C:R[-1]C)"
End With
 
Upvote 0

Forum statistics

Threads
1,221,706
Messages
6,161,406
Members
451,702
Latest member
Kc3475

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