Removing Field Subtotals except for 2 from from PivotTable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please assist

I have the following code to remove the field subtotals except for 2 from
pivot:

for Each pf In ActiveSheet.PivotTables("PivotTable2").PivotFields
If pf.Name = "field1" Or pf.Name = "field2" Then Exit For

pf.Subtotals = Array(False, False, False, False, False, False,
False, False, False, False, False, False)
Next

This code removes all subtotals; however, I want subtotals of the first 2
fields.

Thanks
Gwen
 
for Each pf In ActiveSheet.PivotTables("PivotTable2").PivotFields

If pf.Name <> "field1" and pf.Name <> "field2" Then r

pf.Subtotals = Array(False, False, False, False, False, False,
False, False, False, False, False, False)

End if

Next
 
Thank you.

Tom Ogilvy said:
for Each pf In ActiveSheet.PivotTables("PivotTable2").PivotFields

If pf.Name <> "field1" and pf.Name <> "field2" Then r

pf.Subtotals = Array(False, False, False, False, False, False,
False, False, False, False, False, False)

End if

Next
 
Back
Top