Share via


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.Int32

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

  • TotalList
    Type: System.Object

    Required 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.Object

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

  • PageBreaks
    Type: System.Object

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

Return Value

Type: System.Object

See Also

Reference

Range Interface

Range Members

Microsoft.Office.Interop.Excel Namespace