Pivot Table Pivot Field and Pivot Item Properties

The PivotTable property returns the PivotTable object associated with the PivotCell. The PivotField property returns the PivotField object associated with the PivotCell; and the Pivotltem property returns the Pivotltem associated with the PivotCell. Referring to Figure 20-6, the following code illustrates these properties:

Sub test()

' Refer to Figure 20-6

Dim rng As Range Dim ws As Worksheet

Set ws = ActiveSheet

Debug.Print rng.PivotCell.PivotTable.Name ' returns Debug.Print rng.PivotCell.PivotField ' returns

Transactions

Debug.Print rng.PivotCell.PivotItem.Name ' returns

End Sub

Sales&Trans Sum of

Company

0 0

Post a comment