Excel PivotChart Field Buttons

G

gmead7

I am using Excel 2003. I have a PivotChart with 3 Field Buttons. I want the
user to be able to work with one of the field buttons and I want disable (and
preferably make invisible) the other 2 field buttons. I suspect I may have
to do this through VBA, but haven't been able to find a way to do this yet.
I haven't been able to figure out how to reference the field buttons within
VBA either. I am pre-novice in regards to VBA so I really need the "for
dummies" version (please, be gentle).
 
T

TomPl

You can disable the field button on a pivot chart by disabling
the itemselection property of the field in the underlying
pivot table. This can be accomplished with code similar to
what follows.


Hiding the button on the pivot chart is a different matter.
I don't know how to hide one button without hiding all.


Sub DisablePivotField()

Dim wks As String
Dim pvt As String
Dim fld As String

wks = "2007Pivot"
pvt = "PivotTable2"
fld = "BusUnit"

Worksheets(wks).PivotTables(pvt).PivotFields(fld).EnableItemSelection = False

End Sub

Luck to you.
 
G

gmead7

Thanks Tom - this was very helpful.

TomPl said:
You can disable the field button on a pivot chart by disabling
the itemselection property of the field in the underlying
pivot table. This can be accomplished with code similar to
what follows.


Hiding the button on the pivot chart is a different matter.
I don't know how to hide one button without hiding all.


Sub DisablePivotField()

Dim wks As String
Dim pvt As String
Dim fld As String

wks = "2007Pivot"
pvt = "PivotTable2"
fld = "BusUnit"

Worksheets(wks).PivotTables(pvt).PivotFields(fld).EnableItemSelection = False

End Sub

Luck to you.
 

Ask a Question

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.

Ask a Question

Top