Show & Hide Shape in a Sheet

  • Thread starter Thread starter Pete Csiszar
  • Start date Start date
P

Pete Csiszar

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
 
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
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
 
Back
Top