| Display shapes according to cell value |
|
|
|
| Tutorials | |||
|
The code below changes shapes when a cells values changes. In this example a cell list can hold four shapes (Square, Rectangle, Circle and Star). When selected the shape will be visible.
"Sample code is is downloadable below." Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'*************************************
'**** Code from VisibleVisual.com ****
'*************************************
With ActiveSheet
Select Case ActiveSheet.Range("SHAPE").Value
Case "Circle"
.Shapes("Circle").Visible = True
.Shapes("Square").Visible = False
.Shapes("Rectangle").Visible = False
.Shapes("Star").Visible = False
Case "Square"
.Shapes("Circle").Visible = False
.Shapes("Square").Visible = True
.Shapes("Rectangle").Visible = False
.Shapes("Star").Visible = False
Case "Rectangle"
.Shapes("Circle").Visible = False
.Shapes("Square").Visible = False
.Shapes("Rectangle").Visible = True
.Shapes("Star").Visible = False
Case "Star"
.Shapes("Circle").Visible = False
.Shapes("Square").Visible = False
.Shapes("Rectangle").Visible = False
.Shapes("Star").Visible = True
End Select
End With
End Sub
|




