Export (0) Print
Expand All

AutoSort Method [Excel 2003 VBA Language Reference]

Office 2003

Establishes automatic field-sorting rules for PivotTable reports.

expression .AutoSort(Order, Field)

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

XlSortOrder can be one of these XlSortOrder constants.
xlAscending
xlDescending
xlManual. To disable automatic sorting.

Field   Required String. The name of the sort key field. You must specify the unique name (as returned from the SourceName property), and not the displayed name.

Example

This example sorts the Company field in descending order, based on the sum of sales.

ActiveSheet.PivotTables(1).PivotField("Company") _
    .AutoSort xlDescending, "Sum of Sales"
		


Applies to | PivotField Object


Show:
© 2014 Microsoft