Automate excel subtotals from access

B

Bear

I've got an Access2k app that exports sales data to an excel2k ss. I've got
the data sorted up ok but now I want to have subtotals generated. Can anyone
help me make that happen?

Thanks, Bear
 
K

Klatuu

With xlSheet
.Range(.Cells(lngFirstDataRow - 1, 1), _
.Cells(lngLastDataRow, 19)).Subtotal groupBy:=1,
Function:=xlSum, _
totalList:=Array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19)
End With

the groupby value is the column of the range you want to subtotal on.
the Function is what you want to do
the totallist is the columns you want included
 
B

Bear

Thanks Klatuu, that will be a big help.

Bear

Klatuu said:
With xlSheet
.Range(.Cells(lngFirstDataRow - 1, 1), _
.Cells(lngLastDataRow, 19)).Subtotal groupBy:=1,
Function:=xlSum, _
totalList:=Array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19)
End With

the groupby value is the column of the range you want to subtotal on.
the Function is what you want to do
the totallist is the columns you want included
 
Top