Home Excel VB/VBA Display shapes according to cell value
20 | 05 | 2012
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade

Display shapes according to cell value PDF Print E-mail
User Rating: / 0
PoorBest 
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. 

 

Excel Shape

"Sample code is is downloadable below."

Show/Hidden vbnet code

View source
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
 
 

 

Add comment


Security code
Refresh

This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade