AutoSortOrder Property

Microsoft Excel Visual Basic

AutoSortOrder Property

       

Returns the order used to sort the specified PivotTable field automatically. Can be one of the following XlSortOrder constants. Read-only Long.

XlSortOder can be one of these XlSortOrder constants.
XlAscending
XlDescending
XlManual. If auotmatic sorting is disabled.

expression.AutoSortOrder

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

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