ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Show & Hide Shape in a Sheet (https://www.excelbanter.com/excel-programming/319958-show-hide-shape-sheet.html)

Pete Csiszar[_2_]

Show & Hide Shape in a Sheet
 
Hi All,

Any assistance would be much appreciated.
I'd like to use a togglebuttom to Show / Hide a Shape in a worksheet (in
this case Rectangle 3).
The hide part is easy with using Visible = False but the show part is
hanging me up.

Something tells me that this is a little more complicated than it sounds
because the shape is held in memory location, which means that if it is
hidden at the time the file is opened it needs to be loaded into memory.

Maybe I'm over complicating things?

TIA

Pete



Doug Glancy

Show & Hide Shape in a Sheet
 
Pete,

I think you might be. If you use a togglebutton from the Control Toolbox,
double-click it and add this code to it's click event it will toggle. If
it's not visible when you open the workbook, clicking the button will make
it so.

Private Sub ToggleButton1_Click()
Worksheets("Sheet1").Shapes("Rectangle 3").Visible = Not (Shapes("Rectangle
3").Visible)
End Sub

hth,

Doug Glancy

"Pete Csiszar" wrote in message
news:QI%Bd.47642$KO5.25511@clgrps13...
Hi All,

Any assistance would be much appreciated.
I'd like to use a togglebuttom to Show / Hide a Shape in a worksheet (in
this case Rectangle 3).
The hide part is easy with using Visible = False but the show part is
hanging me up.

Something tells me that this is a little more complicated than it sounds
because the shape is held in memory location, which means that if it is
hidden at the time the file is opened it needs to be loaded into memory.

Maybe I'm over complicating things?

TIA

Pete





Tom Ogilvy

Show & Hide Shape in a Sheet
 
If visible = False hides it, then visible = true should show it.

--
Regards,
Tom Ogilvy

"Pete Csiszar" wrote in message
news:QI%Bd.47642$KO5.25511@clgrps13...
Hi All,

Any assistance would be much appreciated.
I'd like to use a togglebuttom to Show / Hide a Shape in a worksheet (in
this case Rectangle 3).
The hide part is easy with using Visible = False but the show part is
hanging me up.

Something tells me that this is a little more complicated than it sounds
because the shape is held in memory location, which means that if it is
hidden at the time the file is opened it needs to be loaded into memory.

Maybe I'm over complicating things?

TIA

Pete





KRCowen

Show & Hide Shape in a Sheet
 
Pete
I think you are overcomplicating things.

Private Sub ToggleButton1_Change()
ActiveSheet.Shapes("Rectangle 3").Visible = Not (ActiveSheet.Shapes("Rectangle
3").Visible)
End Sub

will probably do what you want.

Good luck.

Ken
Norfolk, Va


All times are GMT +1. The time now is 11:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com