Show / Hide Graph series via button.

User avatar
Steve_in_Kent
4StarLounger
Posts: 419
Joined: 04 Feb 2010, 11:46

Show / Hide Graph series via button.

Post by Steve_in_Kent »

I have a graph with multiple data lines on it. showing various years.

I can create buttons on the graph no problem.. what i want to do, is toggle via each button, the data series, so it shows/hides on each click.

is there a way to hide a data series?

Steve
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!

User avatar
sdckapr
3StarLounger
Posts: 392
Joined: 25 Jan 2010, 12:21

Re: Show / Hide Graph series via button.

Post by sdckapr »

The easiest way is to have the data series pointing to cells with formulas. The formulas can return the desired values or #NAerror based on the button (a check box could also be used instead of a button). The #NA's will not plot.

If you have legend and want to remove them with a toggle, it will require VB to actually add and remove the series...

Steve

User avatar
Steve_in_Kent
4StarLounger
Posts: 419
Joined: 04 Feb 2010, 11:46

Re: Show / Hide Graph series via button.

Post by Steve_in_Kent »

thanks for the hint..

figured this out, using VBA to hide the rows where the data is shown, you can place a button on the graph, and added this code.

Worksheets("Scorecard").Rows("127:129").Hidden = False

Which will hide rows 127 to 129 on the named scorecard.

Steve
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!