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

Can anyone help me understand the parameters of the
subtotal function ?

For example, if in my code I want to do something like
this:

Worksheets("SubTotals").Range("D3: E900").Name = "MyRange"

MyRange.Subtotal GroupBy:=2, Function:=xlSum, _
TotalList:=2, Replace:=True, _
PageBreaks:=False, SummaryBelowData:=False

I'm OK with "Function", "Replace", "PageBreaks"
and "SummaryBelowData", but what is GroupBy and TotalList ?
What would the syntax be in this example ?
Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default subtotal function

Repint from the online help

Subtotal Method


Creates subtotals for the range (or the current region, if the range is a
single cell).

For information about using the Subtotal worksheet function in Visual Basic,
see Using Worksheet Functions in Visual Basic.

Syntax

expression.Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks,
SummaryBelowData)

expression Required. An expression that returns a Range object.

GroupBy Required Long. The field to group by, as a 1-based integer offset.
For more information, see the example.

Function Required Long. The subtotal function. Can be one of the following
XlConsolidationFunction constants: xlAverage, xlCount, xlCountNums, xlMax,
xlMin, xlProduct, xlStDev, xlStDevP, xlSum, xlVar, or xlVarP.

TotalList Required Variant. An array of 1-based field offsets, indicating
the fields to which the subtotals are added. For more information, see the
example.

Replace Optional Variant. True to replace existing subtotals. The default
value is False.

PageBreaks Optional Variant. True to add page breaks after each group. The
default value is False.

SummaryBelowData Optional Variant. Can be one of the following
xlSummaryRow constants: xlSummaryAbove or xlSummaryBelow. The default value
is xlSummaryBelow.


--

HTH

Bob Phillips

"arevans" wrote in message
...
Can anyone help me understand the parameters of the
subtotal function ?

For example, if in my code I want to do something like
this:

Worksheets("SubTotals").Range("D3: E900").Name = "MyRange"

MyRange.Subtotal GroupBy:=2, Function:=xlSum, _
TotalList:=2, Replace:=True, _
PageBreaks:=False, SummaryBelowData:=False

I'm OK with "Function", "Replace", "PageBreaks"
and "SummaryBelowData", but what is GroupBy and TotalList ?
What would the syntax be in this example ?
Thanks for your help.



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
Subtotal Function Anthony Excel Discussion (Misc queries) 5 March 3rd 09 07:32 PM
SubTotal Function [email protected] Excel Discussion (Misc queries) 3 January 20th 07 04:06 AM
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 (again) Kyli Excel Worksheet Functions 2 December 16th 04 06:37 PM


All times are GMT +1. The time now is 03:29 PM.

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

About Us

"It's about Microsoft Excel"