PivotFields Collection Object

Description

A collection of all the PivotField objects in a PivotTable.

Accessors

Use the PivotFields method with an argument to access a single member of the collection or without an argument to access the entire collection at once. The following example uses the Count property of the PivotFields collection to set up a loop that enumerates the pivot field names.


With Worksheets("sheet3").PivotTables(1)
    For i = 1 To .PivotFields.Count
        MsgBox .PivotFields(i).Name
    Next
End With

In some cases, it may be easier to use one of the methods that returns a subset of the pivot fields. The following accessor methods are available: ColumnFields method, DataFields method, HiddenFields method, PageFields method, RowFields method, VisibleFields method.

Properties

Application Property, Count Property, Creator Property, Parent Property.

Methods

Item Method.