object that corresponds to the selected data field.
expression.DataField
expression Required. An expression that returns a PivotCell object.
Remarks
This property will return an error if the PivotCell object is not one of the allowed types: XlPivotCellTypeValue, XlPivotCellTypeDataField, XlPivotCellTypeSubtotal, XlPivotCellTypeGrandTotal.
Example
This example determines if cell L10 is in the data field of the PivotTable and either returns the PivotTable field that corresponds to the cell by notifying the user, or handles the run-time error. The example assumes a PivotTable exists in the active worksheet.
Sub CheckDataField()
On Error GoTo Not_In_DataField
MsgBox Application.Range("L10").PivotCell.DataField
Exit Sub
Not_In_DataField:
MsgBox "The selected range is not in the data field of the PivotTable."
End Sub