Range.Subtotal Method
Creates subtotals for the range (or the current region, if the range is a single cell).
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function Subtotal ( _
GroupBy As Integer, _
Function As XlConsolidationFunction, _
TotalList As Object, _
Replace As Object, _
PageBreaks As Object, _
SummaryBelowData As XlSummaryRow _
) As Object
'Usage
Dim instance As Range
Dim GroupBy As Integer
Dim Function As XlConsolidationFunction
Dim TotalList As Object
Dim Replace As Object
Dim PageBreaks As Object
Dim SummaryBelowData As XlSummaryRow
Dim returnValue As Object
returnValue = instance.Subtotal(GroupBy, _
Function, TotalList, Replace, PageBreaks, _
SummaryBelowData)
Object Subtotal(
int GroupBy,
XlConsolidationFunction Function,
Object TotalList,
Object Replace,
Object PageBreaks,
XlSummaryRow SummaryBelowData
)
Parameters
GroupBy
Type: System.Int32Required Integer. The field to group by, as a one-based integer offset. For more information, see the example.
Function
Type: Microsoft.Office.Interop.Excel.XlConsolidationFunctionRequired XlConsolidationFunction. The subtotal function. Can be one of the following XlConsolidationFunction constants:
xlAverage
xlCount
xlCountNums
xlMax
xlMin
xlProduct
xlStDev
xlStDevP
xlSum
xlUnknown
xlVar
xlVarP
TotalList
Type: System.ObjectRequired Object. An array of 1-based field offsets, indicating the fields to which the subtotals are added. For more information, see the example.
Replace
Type: System.ObjectOptional Object. True to replace existing subtotals. The default value is False.
PageBreaks
Type: System.ObjectOptional Object. True to add page breaks after each group. The default value is False.
SummaryBelowData
Type: Microsoft.Office.Interop.Excel.XlSummaryRowOptional XlSummaryRow. Places the summary data relative to the subtotal. Can be one of the following XlSummaryRow constants:
xlSummaryAbove
xlSummaryBelowdefault
Return Value
Type: System.Object