sub total array

G

Guest

Selection.subtotal GroupBy:=lngcontrolcol1, Function:=xlSum,
TotalList:=Array(13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
Replace:=True, PageBreaks:=False, _
SummaryBelowData:=True

how can i change the array part so that i can dynamically specify which
coulumn i wan the subtotal to calculate.
 
D

Dave Peterson

I'm not sure how you know which fields to sum, but you can build an array with
those field numbers:

dim myArr as variant
myArr = array(3,6,17)

....., totallist:=myarr, ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Subtotal Formatting 2
Using Subtotal: How to update TotalList:= 2
Subtotal Macro Help 2
Subtotal by VBA 5
Subtotals 2
subtotal question 1
Sub-total questions 5
Subtotal macro in each worksheet 13

Top