Code to make graph invisible / invisisble

R

Rick

Hello:

I am a VERY little bit familiar with VBA and am wondering
if someone can assist me in the code necessary to make a
chart disappear / reappear by clicking a command button.

thanks,

Rick
 
D

Don Guillett

try this assigned to a button or shape. I don't like command buttons but do
it if you like.
One click hides the next unhides

Sub togglechart()
ActiveSheet.ChartObjects("Chart 1").Visible = Not
ActiveSheet.ChartObjects("Chart 1").Visible = True
End Sub
 
M

Mike Fogleman

ActiveSheet.ChartObjects.Visible = False
ActiveSheet.ChartObjects.Visible = True
 
P

pfsardella

Watch for linewrap (All one line). Toggles visibility on and off.

Sub Tester()
ActiveSheet.ChartObjects("Chart 95").Visible = Not
ActiveSheet.ChartObjects("Chart 95").Visible
End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top