LayoutForm Property

Microsoft Excel Visual Basic

Show All

LayoutForm Property

       

Returns or sets the way the specified PivotTable items appear—in table format or in outline format. Read/write XlLayoutFormType.

XlLayoutFormType can be one of these XlLayoutFormType constants.
xlTabular Default. 
xlOutline The LayoutSubtotalLocation property specifies where the subtotal appears in the PivotTable report.

expression.LayoutForm

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; 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 removed from the PivotTable report.

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 = xlTop
End With