ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sub total array (https://www.excelbanter.com/excel-programming/373787-sub-total-array.html)

violet

sub total array
 
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.

Dave Peterson

sub total array
 
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, ...



violet wrote:

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.


--

Dave Peterson


All times are GMT +1. The time now is 01:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com