PivotTable Object

Description

Represents a PivotTable on a worksheet.

Accessors

The PivotTable object is a member of the PivotTables collection. The PivotTables collection contains all the PivotTable objects on a single worksheet. Use the PivotTableWizard method to create a new PivotTable and add it to the collection.

To access a single member of the collection, use the PivotTables method with the PivotTable index number or name as an argument.

The following example makes the field named "year" a row field in PivotTable one on the worksheet named "Sheet3."


Worksheets("sheet3").PivotTables(1) _
    .PivotFields("year").Orientation = xlRowField

Use the Name property to set or return the PivotTable name. The following example moves the field named "year" on the PivotTable named "PivotTable2."


Worksheets("sheet3").PivotTables("pivottable2") _
    .PivotFields("year").Position = 2

Because PivotTable programming can be complex, it is generally easier to record PivotTable actions by clicking the Record Macro command on the Tools menu.

Properties

Application Property, ColumnGrand Property, ColumnRange Property, Creator Property, DataBodyRange Property, DataLabelRange Property, HasAutoFormat Property, InnerDetail Property, Name Property, PageRange Property, Parent Property, RefreshDate Property, RefreshName Property, RowGrand Property, RowRange Property, SaveData Property, SourceData Property, TableRange1 Property, TableRange2 Property, Value Property.

Methods

AddFields Method, ColumnFields Method, DataFields Method, HiddenFields Method, PageFields Method, PivotFields Method, RefreshTable Method, RowFields Method, ShowPages Method, VisibleFields Method.