Returning a Fields Collection

Several of the members of the PivotTable object are designed to return a fields collection. 20.5.1.1 ColumnFields property

This property returns the collection of all column fields, using the syntax:

PivotTableObject .ColumnFields

Alternatively, we can return selected column fields using the syntax:

PivotTableObject .ColumnFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes.

20.5.1.2 DataFields property

This property returns the collection of all data fields, using the syntax:

PivotTableObject .DataFields

Alternatively, we can return selected data fields using the syntax:

PivotTableObject .DataFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes.

20.5.1.3 HiddenFields property

As we will see, a pivot field can be hidden by setting its orientation to xlHidden. The HiddenFields property returns the collection of all hidden fields, using the syntax:

PivotTableObject .HiddenFields

Alternatively, we can return selected hidden fields using the syntax:

PivotTableObject .HiddenFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes.

20.5.1.4 PageFields property

The PageFields property returns the collection of all page fields, using the syntax:

PivotTableObject .PageFields

Alternatively, we can return selected page fields using the syntax:

PivotTableObject .PageFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes.

20.5.1.5 PivotFields property

The PivotFields property returns the collection of all pivot fields, using the syntax:

PivotTableObject .PivotFields

Alternatively, we can return selected pivot fields using the syntax:

PivotTableObject .PivotFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes.

20.5.1.6 RowFields property

The RowFields property returns the collection of all row fields, using the syntax:

PivotTableObject .RowFields

Alternatively, we can return selected row fields using the syntax:

PivotTableObject .RowFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes. 20.5.1.7 VisibleFields property

The VisibleFields property returns the collection of all visible fields, using the syntax:

PivotTableObject .VisibleFields

Alternatively, we can return selected visible fields using the syntax:

PivotTableObject .VisibleFields( Index)

where Index is either a single index (the index number of the desired field) or an array of indexes.

0 0

Post a comment