Here is the code:
Selection.Subtotal GroupBy:=CInt(atGby), Function:=xlSum,
TotalList:=Array(aiSub(1), _
aiSub(2), aiSub(3), aiSub(4), aiSub(5), aiSub(6), aiSub(7), aiSub(8),
aiSub(9), aiSub(10), _
aiSub(11), aiSub(12), aiSub(13), aiSub(14)), Replace:=abReplace,
PageBreaks:=abPageBreak, SummaryBelowData:=abSummary
Where aiSub() is an Array interger type, and atGby for group by like for 1st
level 1, 2nd Level 2 and so on.
Recently I've discovred if i pass TotalList:= Array(17,18,19,....) it works
perfectly but using aiSub() array element, giving me wrong position.