View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
P Britt P Britt is offline
external usenet poster
 
Posts: 1
Default SubTotals Problem

I am using the following code to subtotal columns in an Excel worksheet

rRange.Subtotal 1, xlSum, iSubTotalColumns, True, False, xlSummaryBelo
rRange.Subtotal 2, xlSum, iSubTotalColumns, False, False, xlSummaryBelo
rRange.Subtotal 3, xlSum, iSubTotalColumns, False, False, xlSummaryBelo

It works fine when the values in the columns that I am grouping by vary. However, I have some cases where the value does not change in the column that I am grouping on. When that happens, the subtotals end up being displayed in the wrong order (based on their grouping level) even though they have the correct totals. (The order should be the colmun 1 subtotal, the column 2 subtotal, and last the column 3 subtotal from the code. However, when column 2 values do not vary the order ends up being column 3 subtotal, column 1 subtotal, and last column 2 subtotal.) This does not happen when I subtotal these worksheets manually in Excel, only when I do it through code in my VB program.