Microsoft Office Tutorials and References
In Depth Information
Example 20-2. The ShowFields Procedure
Debug.Print ""
Debug.Print "After data fields:"
ShowFields
.PivotFields("Data").Orientation = xlRowField
.PivotFields("Data").Position = 3
End With
End Sub
The ShowFields procedure used in CreatePivotFields is shown in Example 20-2 ; it
simply prints (to the Immediate window) a list of all pivot fields and is very useful for
experimenting or debugging.
Example 20-2. The ShowFields Procedure
Sub ShowFields()
Dim pf As PivotField
Debug.Print "*PivotFields:"
For Each pf In _
ActiveSheet.PivotTables("Sales&Trans").PivotFields
Debug.Print pf.Name
Next
Debug.Print "*RowFields:"
For Each pf In _
ActiveSheet.PivotTables("Sales&Trans").RowFields
Debug.Print pf.Name
Next
Debug.Print "*ColFields:"
For Each pf In _
ActiveSheet.PivotTables("Sales&Trans").ColumnFields
Debug.Print pf.Name
Next
Debug.Print "*DataFields:"
For Each pf In _
ActiveSheet.PivotTables("Sales&Trans").DataFields
Debug.Print pf.Name
Next
End Sub
Running CreatePivotFields results in the following display to the Immediate window:
Before all:
*PivotFields:
Year
Period
Store Code
Store City
Store Type
Transactions
Sales
 
 
Search JabSto ::




Custom Search