Macro to change what's displayed in the graph

Stephenf_07

New Member
Joined
Apr 19, 2011
Messages
8
Hello,

I currently have a line graph that display 9 different categories in the legend over a period of 3 weeks. With 9 different lines going on at once in the graph, it can be tricky to view as the graph is not very big. I have inserted 9 different checkbox forms next to the graph with my categories next to it. Is there a way that I can assign a Macro to the checkbox that basically states when the box is checked, the line is displayed in the graph and when the box is not checked, the data is not displayed? This way someone who is not user friendly using the graph could easily just check the box's of only the categories they would like to display on the graph.

I am using Excel 2010. The line graph is just a standard 2D graph.

Legend:
Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 7
Category 8
Category 9

Y Axis:
1
2
3
4
5


X Axis:
Week 1
Week 2
Week 3

EX.) Checking the checkbox next to Category 5 will only display 1 line on the graph.

Hope this makes sense! Thanks in advance for any help!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I make use of the feature where Excel charts ignore cells with #N/A.
I would link each check-box to a cell and this would then contain either TRUE or FALSE.
Each of those cells would be given a 'name' - e.g. Required1, Required2 etc.
Then the formula in each cell that feeds the chart needs to be changed so, for example:
='Sheet1'!A1
would become:
=IF(Required1,'Sheet1'!A1,NA())
This will not affect the legend and, if that is a problem, you can partly deal with it using conditional formatting for the font (making it 'white'). I don't think that it can be completely removed because the series is still associated with the chart - it is just that the values will not be plotted.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,261
Members
452,901
Latest member
LisaGo

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