Pivot Field Object Pivot Fields Collection and the Calculated Fields Example

Sub AddField()

Dim oPT As PivotTable

Dim oPF As PivotField

'Set target pivot table

Set oPT = ActiveSheet.PivotTables(l)

'Add a calculated field

Set oPF = oPT.CalculatedFields.Add("Total",

"=Price * Volume",

True)

oPF.Orientation = xlDataField

End Sub

0 0

Post a comment