I am subtotaling orders for total pieces and weight.
Example:
ITEM.....PCS......WT............IN STOCK
Shirt......5...........7.................96
Shirt......12.........16...............96
Shirt......3...........5..................96
------------------------
Shirt....20..........28...........?(96)?
MY CODE:
With ws
'find last data row
endrow = Cells(Rows.Count, stcol).End(xlUp).Row
'sort data
Set drng = .Range(.Cells(strow, stcol), .Cells(endrow, endcol))
drng.Sort Key1:=.Cells(strow + 1, stcol), Order1:=xlAscending, Header:=xlYes
'apply Excel SubTotal function
.Cells.RemoveSubtotal
drng.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(6, 9)
End With
The 'GroupBy:=1' is what makes the Shirt in the total line and if i change the 1 to a 4 it will put the 96 in the total line. How do i get it to show 1 and 4 (Shirt and 96) at the same time?
Example:
ITEM.....PCS......WT............IN STOCK
Shirt......5...........7.................96
Shirt......12.........16...............96
Shirt......3...........5..................96
------------------------
Shirt....20..........28...........?(96)?
MY CODE:
With ws
'find last data row
endrow = Cells(Rows.Count, stcol).End(xlUp).Row
'sort data
Set drng = .Range(.Cells(strow, stcol), .Cells(endrow, endcol))
drng.Sort Key1:=.Cells(strow + 1, stcol), Order1:=xlAscending, Header:=xlYes
'apply Excel SubTotal function
.Cells.RemoveSubtotal
drng.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(6, 9)
End With
The 'GroupBy:=1' is what makes the Shirt in the total line and if i change the 1 to a 4 it will put the 96 in the total line. How do i get it to show 1 and 4 (Shirt and 96) at the same time?