PivotTable.AddFields (Excel)

Adds row, column, and page fields to a PivotTable report or PivotChart report.

You must specify one of the field arguments. Field names specify the unique name returned by the SourceName property of the PivotField object. This method is not available for OLAP data sources.

AddFields (RowFields, ColumnFields, PageFields, AddToTable)


Worksheets("Sheet1").PivotTables(1).AddFields _ 
 ColumnFields:=Array("Status", "Closed_By")
 

Arguments

Optional arguments

The following arguments are optional

RowFields (String) - Specifies a field name (or an array of field names) to be added as rows or added to the category axis.

ColumnFields (String) - Specifies a field name (or an array of field names) to be added as columns or added to the series axis.

PageFields (String) - Specifies a field name (or an array of field names) to be added as pages or added to the page area.

AddToTable (Boolean) - Applies only to PivotTable reports. True to add the specified fields to the report (none of the existing fields are replaced). False to replace existing fields with the new fields. The default value is False.