ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I turn the visibility of a shape on one sheet off and on? (https://www.excelbanter.com/excel-programming/433798-how-do-i-turn-visibility-shape-one-sheet-off.html)

Jarla61

How do I turn the visibility of a shape on one sheet off and on?
 
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?

Jacob Skaria

How do I turn the visibility of a shape on one sheet off and on?
 
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
---------------
Jacob Skaria


"Jarla61" wrote:

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?


Mario[_11_]

How do I turn the visibility of a shape on one sheet off and on?
 
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


All times are GMT +1. The time now is 10:38 PM.

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