PivotTable.GetPivotData method (Excel)

Returns a Range object with information about a data item in a PivotTable report.

Syntax

expression.GetPivotData (DataField, Field1, Item1, Field2, Item2, Field3, Item3, Field4, Item4, Field5, Item5, Field6, Item6, Field7, Item7, Field8, Item8, Field9, Item9, Field10, Item10, Field11, Item11, Field12, Item12, Field13, Item13, Field14, Item14)

expression A variable that represents a PivotTable object.

Parameters

Name Required/Optional Data type Description
DataField Optional Variant The name of the field containing the data for the PivotTable.
Field1 Optional Variant The name of a column or row field in the PivotTable report.
Item1 Optional Variant The name of an item in Field1.
Field2 Optional Variant The name of a column or row field in the PivotTable report.
Item2 Optional Variant The name of an item in Field2.
Field3 Optional Variant The name of a column or row field in the PivotTable report.
Item3 Optional Variant The name of an item in Field3.
Field4 Optional Variant The name of a column or row field in the PivotTable report.
Item4 Optional Variant The name of an item in Field4.
Field5 Optional Variant The name of a column or row field in the PivotTable report.
Item5 Optional Variant The name of an item in Field5.
Field6 Optional Variant The name of a column or row field in the PivotTable report.
Item6 Optional Variant The name of an item in Field6.
Field7 Optional Variant The name of a column or row field in the PivotTable report.
Item7 Optional Variant The name of an item in Field7.
Field8 Optional Variant The name of a column or row field in the PivotTable report.
Item8 Optional Variant The name of an item in Field8.
Field9 Optional Variant The name of a column or row field in the PivotTable report.
Item9 Optional Variant The name of an item in Field9.
Field10 Optional Variant The name of a column or row field in the PivotTable report.
Item10 Optional Variant The name of an item in Field10.
Field11 Optional Variant The name of a column or row field in the PivotTable report.
Item11 Optional Variant The name of an item in Field11.
Field12 Optional Variant The name of a column or row field in the PivotTable report.
Item12 Optional Variant The name of an item in Field12.
Field13 Optional Variant The name of a column or row field in the PivotTable report.
Item13 Optional Variant The name of an item in Field13.
Field14 Optional Variant The name of a column or row field in the PivotTable report.
Item14 Optional Variant The name of an item in Field14.

Return value

Range

Example

In this example, Microsoft Excel returns the quantity of chairs in the warehouse to the user. This example assumes that a PivotTable report exists on the active worksheet. Also, this example assumes that, in the report, the title of the data field is Quantity, a field titled Warehouse exists, and a data item titled Chairs exists in the Warehouse field.

Sub UseGetPivotData() 
 
 Dim rngTableItem As Range 
 
 ' Get PivotData for the quantity of chairs in the warehouse. 
 Set rngTableItem = ActiveCell. _ 
 PivotTable.GetPivotData("Quantity", "Warehouse", "Chairs") 
 
 MsgBox "The quantity of chairs in the warehouse is: " & rngTableItem.Value 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.