PivotField.AutoSortField property (Excel)

Returns the name of the data field used to sort the specified PivotTable field automatically. Read-only String.

Syntax

expression.AutoSortField

expression A variable that represents a PivotField object.

Example

This example displays a message box showing the AutoSort parameters for the Product field.

With Worksheets(1).PivotTables(1).PivotFields("product") 
 Select Case .AutoSortOrder 
 Case xlManual 
 aso = "manual" 
 Case xlAscending 
 aso = "ascending" 
 Case xlDescending 
 aso = "descending" 
 End Select 
 MsgBox " sorted in " & aso & _ 
 " order by " & .AutoSortField 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.