How to make buttons to show and hide a chart in excel

preview_player
Показать описание
How to show and hide a chart using VBA in excel.

Sub hidechart()

ActiveSheet.Shapes("Chart1").Visible = msoFalse
ActiveSheet.Shapes("hidebox").Visible = msoFalse
ActiveSheet.Shapes("showbox").Visible = msoTrue

End Sub

Sub showchart()

ActiveSheet.Shapes("Chart1").Visible = msoTrue
ActiveSheet.Shapes("hidebox").Visible = msoTrue
ActiveSheet.Shapes("showbox").Visible = msoFalse

End Sub
Рекомендации по теме
Комментарии
Автор

Clever, quick and simple. I would have spent an hour or so struggling thru without your crisp and concise explanation.
Thank you.

gregoryolsen
Автор

Just what I was looking for. I'm about to make a presentation and wanted to explain the concept before showing the chart. As Roy said the perfect touch is having the Show/Hide buttons appearing to toggle. Thank you very much.

davetattersfield
Автор

Thanks for this. It's exactly what I need to do for a customer today. I especially like the bit where you put the Show and Hide boxes on top of each other so it looks like there's just one box.

axfordra
Автор

May God Bless you. Very useful, crystal clear.

deepakchander
Автор

God bless you for teaching this. It helped me a lot.

rishikulshrestha
Автор

This was an excellent little clip. Very handy. A big thank you for your time and effort.

fragranceenthusiast
Автор

This worked perfectly! Easy to follow video as well. I would like add another layer to this. I would like the SHOW button to only display the chart, if all cells in a selected range are not blank. If any blanks, then throw a message requiring that range to be complete. Do you have any suggestions on how I can achieve this? Thank you

smitha
Автор

I have added 5 charts and used the shown technique making show and hide buttons for each chart. Can you pls help if there is any solution to show only the latest chart on the top of the visible charts. Thanks.

ananddez
Автор

I have a small project in excel. Will hardly take 30 mins for you. I'll pay you for work and you can put that project in YouTube also. Please provide your email if possible.

rishikulshrestha