Link to home
Start Free TrialLog in
Avatar of Cynthia Hill
Cynthia HillFlag for United States of America

asked on

Hide chart legend using VB

I am trying to find a way to hide / unhide a chart legend using VB (it will be based on user selections)

I have found code to hide a full chart, which works great…but I only want to hide / unhide the chart legend.  

I don’t want to just delete the chart legend, b/c  I want to preserve the established format, position, etc so when it’s unhidden, it will be formatted as needed, and in the proper position.
 
Code below to hide full chart….I only want to hide the chart legend.
Sheets("Supporting Detail").ChartObjects("Chart 19").Visible = False
Avatar of byundt
byundt
Flag of United States of America image

You can delete the legend with:
Sheets("Supporting Detail").ChartObjects("Chart 19").Chart.Legend.Delete
Avatar of Cynthia Hill

ASKER

byundt - Thanks for the responce.

However, as mentioned in my original post, I do not want to delete the legend as I want to presevre the format, position, etc, etc or the legend when it is unhiden.

I only want to HIDE  the chart legend.
SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The solution provided was informative, but did not fullly meet the needs of what I was trying to accomplish.  I ended up going a nother route.
CyHill,
What exactly did you end up doing?

Describing the method you ended up with would be much more valuable in the Experts Exchange database than merely stating "I ended up going another route."

Brad