April 2006
Beginner
1114 pages
98h 16m
English
pivotfield.PivotItems([Index])
Returns the collection of PivotItems for the field. The following code displays the pivot fields and items from a pivot table in the Immediate window:
Sub ShowPivotTableValues( )
Dim pt As PivotTable, pf As PivotField, pi As PivotItem
' Exit if pivot table doesn't exist.
If ActiveSheet.PivotTables.Count < 1 Then Exit Sub
' Get pivot table.
Set pt = ActiveSheet.PivotTables(1)
' Get pivot fields
For Each pf In pt.PivotFields
' Display pivot fields and items in outline form.
Debug.Print pf.name
For Each pi In pf.PivotItems
Debug.Print , pi.Value
Next
Next
End SubRead now
Unlock full access