How to show or hide categories on an Excel Pie chart using VBA

ddfarren

New Member
Joined
May 8, 2018
Messages
1
I've spent hours researching this question with no results and the Excel object model posted in MSDN has not been any help. I have an Excel spreadsheet with a prebuilt pie chart that is opened by Access and manipulated via VBA. The data to be displayed is populated and the resulting chart is used in an Access report. I did not build the original spreadsheet but I've modified it for my own use. A user pointed out that one of the categories was missing. Right-clicking on the chart and clicking on "select data" brings up the "Select Data Source" dialog box. The categories are listed on the right-hand side. Several were unchecked. I've manually selected them all and now the chart is correct.

The question is: I might want to unselect and (more importantly) re-select one of these categories using VBA code. Can this be done and if so, how? Just point me in the right direction and I'll figure out the rest.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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