Simple(?) Pivot table VBA

df9864

Board Regular
Joined
Sep 28, 2004
Messages
108
I want to put some light code on a pivot table that expands / collapses detail.
The command to show / hide the detail works but I get an error on the IF statement:
"application or object defined error".
I suspect there's a problem with my syntax - any ideas?


If ActiveSheet.PivotTables("Mgr_Fcst_Plan_FTE1").PivotFields("Project Name").ShowDetail = False Then
ActiveSheet.PivotTables("Mgr_Fcst_Plan_FTE1").PivotFields("Project Name").ShowDetail = True
Else
ActiveSheet.PivotTables("Mgr_Fcst_Plan_FTE1").PivotFields("Project Name").ShowDetail = False
 
I could but don't want to crowd the worksheet (may have some extra buttons too).
There must be a way to assess the 'value' but can't figure it out.

ActiveSheet.PivotTables("Fcst_Invest_FTE1").PivotFields("Project Name").ShowDetail.Value

doesnt work either (ie. ".value")
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
hmm me neither - tho I do have Excel 2007 and it should work the same.
The code on the link is a little baffling. I've tried to declare / 'get' the value without success...
Surely there's a simple way to find out whether or not the pivot field is showing detail?
 
Upvote 0
Thanks for your help tho. .much appreciated.
Challenge to anyone else out there tho !!

FYI - not sure it makes any odds, but the pivot is in Excel 2007 but displaying as an old fashioned tabular pivot...
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,847
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top