ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing Field Subtotals except for 2 from from PivotTable (https://www.excelbanter.com/excel-programming/392959-removing-field-subtotals-except-2-pivottable.html)

Gwen

Removing Field Subtotals except for 2 from from PivotTable
 
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

Tom Ogilvy

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


Gwen

Removing Field Subtotals except for 2 from from PivotTable
 
Thank you.

"Tom Ogilvy" wrote:

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



All times are GMT +1. The time now is 04:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com