Avatar of Cynthia Hill
Cynthia Hill
Flag 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
Microsoft ApplicationsProgramming Languages-Other

Avatar of undefined
Last Comment
byundt

8/22/2022 - Mon
byundt

You can delete the legend with:
Sheets("Supporting Detail").ChartObjects("Chart 19").Chart.Legend.Delete
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
byundt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
byundt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Cynthia Hill

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Cynthia Hill

ASKER
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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
byundt

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