boblarson
Smeghead
- Local time
- Today, 11:28
- Joined
- Jan 12, 2001
- Messages
- 32,059
I am trying to programmatically get subtotals in my Excel worksheet (after sending the data from Access and still using an Access module to do this) and I keep getting an error
It works fine if I use specific numbers:
But fails if I try to use a variable (which has the same exact values of 7, 8, 9, 10, 11)
There must be something in the way I'm trying to use the variable in the array. Any ideas?

It works fine if I use specific numbers:
Code:
.Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(7, 8, 9, 10, 11), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Code:
.Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(strSubTotalList), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
There must be something in the way I'm trying to use the variable in the array. Any ideas?