Share via


PivotTable Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa218969.parchild(en-us,office.10).gifPivotTable
Aa218969.space(en-us,office.10).gifAa218969.parchild(en-us,office.10).gif

Represents a PivotTable report on a worksheet. The PivotTable object is a member of the PivotTables collection. The PivotTables collection contains all the PivotTable objects on a single worksheet.

Using the PivotTable Object

Use PivotTables(index), where index is the PivotTable index number or name, to return a single PivotTable object. The following example makes the field named year a row field in the first PivotTable report on Sheet3.

  Worksheets("Sheet3").PivotTables(1) _
    .PivotFields("Year").Orientation = xlRowField

Remarks

Because PivotTable report programming can be complex, it’s generally easiest to record PivotTable report actions and then revise the recorded code. To record a macro, point to Macro on the Tools menu and then click Record New Macro.