If you want to do something in code with each pivot field, you can refer
to the pivotfields method. For example, the following code turns off the
subtotals for each field:
'=====================
Sub NoSubtotalsOrGrandTotals()
'turns off subtotals and grand totals
'.PivotFields could be changed to
'.RowFields or .ColumnFields
Dim pt As PivotTable
Dim pf As PivotField
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
For Each pf In pt.PivotFields
'First, set index 1 (Automatic) to True,
'so all other values are set to False
pf.Subtotals(1) = True
pf.Subtotals(1) = False
Next pf
With pt
.ColumnGrand = False
.RowGrand = False
End With
Next pt
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.