Excel VBA Subtotal Function

Hi,

I am running a report in Excel which makes use of the Subtotal function found under the Data menu in Excel. It takes the following arguements,

expression.Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData)

The problem I have is the TotalList arguement. When recording a macro (never the best thing) this arguement has the value Array(17, 61). As my report is dynamic I need to know what this Array is doing and I can make it relative.

Thanks for any help,

Mark
mcs26Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RichardSchollarCommented:
So that's telling you that the subtotals will be added to fields 17 and 61 which, if your data starts in column A, should correspond to columns Q and BI on the sheet.

Richard
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TracyVBA DeveloperCommented:
TotalList:=Array(10, 11, 12 , 13, 14, 15, 16)  - This is refering to the columns that will be summed up (all the the fields you check off in the Add Subtotal To section (see below))

In this example I highlighted A1 to P100 to subtotal.  I grouped on column C and my subtotals will be shown in columns J-P (10-16).
Subtotals.jpg
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.