View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Removing Field Subtotals except for 2 from from PivotTable

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

--
Regards,
Tom Ogilvy



"Gwen" wrote:

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