Share via


GroupedAutoFit Property

True if the specified field's column width is set automatically when the field is used on the row axis or the column axis. To set the width of a field's column, set the property to False. Then, set the GroupedWidth property of the field to the desired width. The default value is True. Read/write Boolean.

Applies to | PivotField Object

See Also | GroupedFont Property | GroupedForeColor Property | GroupedHAlignment Property | GroupedHeight Property | GroupedWidth Property

expression.GroupedAutoFit

*expression   * Required. An expression that returns a PivotField object.

Example

This example disables the GroupedAutoFit property of the "ProductName" field in PivotTable1 and then sets the width of the field to 150 pixels.

Sub Set_ColumnWidth()
    Dim fldProducts
    
    ' Set a variable to the ProductName field.
    Set fldProducts = PivotTable1.ActiveView.FieldSets("ProductName").Fields(0)
    
    ' Set the GroupedAutoFit for the ProductName field.
    fldProducts.GroupedAutoFit = False
    
    ' Set the width of the ProductName field to 150 pixels.
    fldProducts.GroupedWidth = 150
End Sub