Atholl
Active Member
- Joined
- May 19, 2002
- Messages
- 436
Hi all,
The following code works a kind of traffic light system which colours a shape and brings it to the front depending on the contents of a cell (K18). The code works perfectly for my 28 shapes but I feel I could streamline this as it's veeerrrrrry long winded! Unfortunately, everything I've tried thus far hasn't worked.
Has anyone any suggestions?
Atholl
The following code works a kind of traffic light system which colours a shape and brings it to the front depending on the contents of a cell (K18). The code works perfectly for my 28 shapes but I feel I could streamline this as it's veeerrrrrry long winded! Unfortunately, everything I've tried thus far hasn't worked.
Has anyone any suggestions?
Atholl
Code:
If Worksheets("Summary").Range("K18") = "A" Then
ActiveSheet.Shapes("SHAPE 1").ZOrder msoBringToFront
ActiveSheet.Shapes("SHAPE 1").Fill.ForeColor.SchemeColor = 12
ActiveSheet.Shapes("SHAPE 1").Fill.Solid
ActiveSheet.Shapes("SHAPE 1").Fill.Transparency = 0.5
ElseIf Worksheets("Summary").Range("K18") = "B" Then
ActiveSheet.Shapes("SHAPE 1").ZOrder msoBringToFront
ActiveSheet.Shapes("SHAPE 1").Fill.ForeColor.SchemeColor = 57
ActiveSheet.Shapes("SHAPE 1").Fill.Solid
ActiveSheet.Shapes("SHAPE 1").Fill.Transparency = 0.5
ElseIf Worksheets("Summary").Range("K18") = "C" Then
ActiveSheet.Shapes("SHAPE 1").ZOrder msoBringToFront
ActiveSheet.Shapes("SHAPE 1").Fill.ForeColor.SchemeColor = 52
ActiveSheet.Shapes("SHAPE 1").Fill.Solid
ActiveSheet.Shapes("SHAPE 1").Fill.Transparency = 0.5
ElseIf Worksheets("Summary").Range("K18") = "D" Then
ActiveSheet.Shapes("SHAPE 1").ZOrder msoBringToFront
ActiveSheet.Shapes("SHAPE 1").Fill.ForeColor.SchemeColor = 10
ActiveSheet.Shapes("SHAPE 1").Fill.Solid
ActiveSheet.Shapes("SHAPE 1").Fill.Transparency = 0.5
ElseIf Worksheets("Summary").Range("K18") = "0" Then
ActiveSheet.Shapes("SHAPE 1").ZOrder msoSendToBack
End If