How do I turn the visibility of a shape on one sheet off and on?

  • Thread starter Thread starter Jarla61
  • Start date Start date
J

Jarla61

I have a drop-down menu on one worksheet in a workbook with choices of Left &
Right. The result is linked to a cell on that sheet.
I want to turn a rectangle shape on or off on another worksheet in the same
workbook depending on whether I select Left or Right.
How would one do that?
 
Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
If Range("A1") = "Left" Then Me.Shapes("Rectangle 9").Visible = True
If Range("A1") = "Right" Then Me.Shapes("Rectangle 9").Visible = False
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
 
If you are familiar with VBA
you could try this code to hide or unhide the shape:

Private Sub ComboBox1_Change()
If Me.ComboBox1.Value = "Left" Then
ActiveSheet.Shapes("rectangle 2").Visible = False
Else
ActiveSheet.Shapes("rectangle 2").Visible = True
End If

End Sub
 
Back
Top