Macro to total each column in Table

FrankMcNally

Board Regular
Joined
Nov 14, 2014
Messages
71
This is a simple solution I'm sure, but I can't find it!!

I have created a macro that makes a Table of Columns A:M.
I have figured out the VBA Code to 'turn-on' the Total Row at the bottom.
I need the coding to Sum Columns D,E,F,G,H,I,J,K,L & M?

I found:
VBA Code:
Range("D33:M33").AutoFill Destination:=Range("D33:M33"), Type:=xlFillDefault
but that's not it.

Any and all help is appreciated.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Update: This works but it's bulky
VBA Code:
ActiveSheet.ListObjects("Table1").ListColumns("Revised Budget"). _
        TotalsCalculation = xlTotalsCalculationSum
    Range("E33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Disbursed").TotalsCalculation = _
        xlTotalsCalculationSum
    Range("F33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Accrual").TotalsCalculation = _
        xlTotalsCalculationSum
    Range("G33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Banked").TotalsCalculation = _
        xlTotalsCalculationSum
    Range("H33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Sub-Total").TotalsCalculation = _
        xlTotalsCalculationSum
    Range("I33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Forecast").TotalsCalculation = _
        xlTotalsCalculationSum
    Range("J33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Planned").TotalsCalculation = _
        xlTotalsCalculationSum
    Range("K33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Sub-Total2").TotalsCalculation _
        = xlTotalsCalculationSum
    Range("L33").Select
    ActiveSheet.ListObjects("Table1").ListColumns("Total").TotalsCalculation = _
        xlTotalsCalculationSum
 
Upvote 0
How about
VBA Code:
Sub FrankMcNally()
   Dim Ary As Variant
   Dim i As Long
   
   Ary = Array("Revised Budget", "Disbursed", "Accrual", "Banked", "Sub-Total", "Forecast", "Planned", "Sub-Total2", "Total")
   With ActiveSheet.ListObjects("Table1")
      For i = 0 To UBound(Ary)
         .ListColumns(Ary(i)).TotalsCalculation = xlTotalsCalculationSum
      Next i
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

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