Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 1.95 KB

Excel.PivotFields.md

File metadata and controls

69 lines (46 loc) · 1.95 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
PivotFields object (Excel)
vbaxl10.chm241072
vbaxl10.chm241072
Excel.PivotFields
018d4cea-09ea-d4be-baef-5fd55062935b
03/30/2019
medium

PivotFields object (Excel)

A collection of all the PivotField objects in a PivotTable report.

Remarks

In some cases, it may be easier to use one of the properties that returns a subset of the PivotTable fields. The following properties are available:

Example

Use the PivotFields method of the PivotTable object to return the PivotFields collection.

The following example enumerates the field names in the first PivotTable report on Sheet3.

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

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

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

Methods

Properties

See also

[!includeSupport and feedback]