With PT.PivotFields(“Units”)
.Orientation = xlDataField
.Function = xlSum
.Position = 2
.NumberFormat = “#,##0”
End With
Chapter 11 Using VBA to Create Pivot Tables
258
11
Figure 11.12
The default pivot table
report has multiple data
fields as the innermost
column field.
Figure 11.13
By moving the data field
to the first row field,you
can obtain this view of
the multiple data fields.
Calculated Data Fields
Pivot tables offer two types of formulas. The most useful type defines a formula for a calcu-
lated field. This adds a new field to the pivot table. Calculations for calculated fields are
12_0789736012_CH11.qxd 12/11/06 6:26 PM Page 258