Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
sum products...
Hi,
Is there another way without posting it in a total column b/c the person whom i'm writting this VBA code for wants the cost*number from the column for each column. And, that cost*number should appear under each column. For example: Let's say I have this: A B cost C D E F G H I J... 1 Pets cats 2.00 1 3 2 4 3 5 4 3... 2 Pets cats 3.00 3 4 2 5 7 3 2 3... ... ...total cost for all cats (please see below) total for cats... 3 Pets dogs 2.00 2 2 3 4 34 23 23 23... 4 Pets dogs 1.00 4 5 13 4 34 23 23 23... total for dogs.. ... ... total for Pets.. ..... ..... ..... **total cost for all cats: ... C D E F G H I J... ... $2 $6 $4 $8 $6 $10 $8 $6... ... $9 $12 $6 $15 $21 $9 $6 $9... (then sum that up in another row:) ... $11 $18 $10 $23 $27 $19 $14 $15 Please use the subtotals for from data menu. what I have is this: *num is a variable for where the column of the array should start.. Dim varr() Dim rng As Range, i As Long Set rng = Range("IV1").End(xlToLeft) ReDim varr(1 To rng.Column - num) For i = 1 To rng.Column - num varr(i) = i + num Next ActiveCell.Range("A3").Select Selection.subtotal GroupBy:=groups, Function:=xlSum, _ TotalList:=varr, Replace:=False, PageBreaks:=False, _ SummaryBelowData:=True Other questions: Can I write the above subtotal function in a different format? and Can I disable the grand total summary from the subtotal function If you could help me with that, that would be wonderful. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sum of similar products | Excel Discussion (Misc queries) | |||
add numbers with corresponding products | Excel Worksheet Functions | |||
deleting products | Excel Discussion (Misc queries) | |||
Products | Excel Worksheet Functions | |||
Sum of products | Excel Programming |