LayoutSubtotalLocation Property

Microsoft Excel Visual Basic

XlSubtototalLocationType can be one of these XlSubtototalLocationType constants.
xlAtTop
xlAtBottom default

expression.LayoutSubtotalLocation

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

You can set this property for any PivotTable field in outline format; however, the formatting appears only if the specified field is a row field other than the innermost (lowest level) row field. For non- OLAP data sources, the value of this property doesn’t change when the field is rearranged or when it is added to or from removed from the report.

The LayoutForm property determines whether the report appears in table format or in outline format.

Example

This example displays the state field in the first PivotTable report on the active worksheet in outline format, and it displays the subtotals at the top of the field.

With ActiveSheet.PivotTables("PivotTable1") _
        .PivotFields("state")
    .LayoutForm = xlOutline
    .LayoutSubtotalLocation = xlAtTop
End With