[AccessD] Excel Subtotal from Access/VBA

Kenneth W Van Huss kvanhuss at airrsystem.com
Fri Oct 28 20:58:10 CDT 2011


This is eating my lunch. I am trying to calculate a subtotal in an Excel
spreadsheet via automation/VBA

 

Code: Select all

    With ApXL

        .Range("A2").Select

        .Selection.Subtotal GroupBy:=4, Function:=xlSum,
TotalList:=Array(12), _

            Replace:=True, PageBreaks:=False, SummaryBelowData:=True

        .ActiveSheet.Outline.ShowLevels RowLevels:=2

        .Columns("L:L").Style = "Currency"

        .Rows("1:1").Font.Bold = True

    End With

 

 

I keep getting an error on the ".Selection.sub . .." line. The error message
is "The command could not be completed by using the range specified. Select
a single cell within the range and try the command again."

 

Any help is greatly appreciated. 

 

Ken




More information about the AccessD mailing list