Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Subtotal function


I have some VBA code that should subtotal a table based on the 1st column and
then resubtotal on the second column. The problem I am having is that the
second subtotal puts the "Section Total" label in the first column as well.
Any ideas on what I am doing wrong? Thanks for the help:

ColStart = 2
ColEnd = lvlColumn + 2

ReDim Columns(0 To (ColEnd - ColStart))
For i = ColStart To ColEnd
Columns(i - ColStart) = i
Next i

ColSt = 2
ColEn = lvlColumn + 2

ReDim Columns2(0 To (ColEn - ColSt))
For n = ColSt To ColEn
Columns2(n - ColSt) = n
Next n

With xlSheet.Range("A:ZZ")
.Cells.Copy
.Cells.PasteSpecial (xlPasteValues)
.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Columns, _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Columns2, _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
End With
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Subtotal function Usman Meer Excel Discussion (Misc queries) 0 January 16th 09 02:29 PM
Embed a countif function in subtotal function? Stuck at work Excel Worksheet Functions 1 February 14th 06 03:19 AM
How do I nesting subtotal function within average function in Exc Amy Yeh Excel Worksheet Functions 4 January 19th 05 06:23 PM
Subtotal function Kyli Excel Worksheet Functions 3 December 16th 04 05:57 PM
subtotal function Erin.[_2_] Excel Programming 1 December 3rd 03 06:30 PM


All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"