H
harteorama
Hi all,
Can anybody please help... i have the code below that changes the Shape
(Freeform 13) on a Chart2 tab, in Sheet1 in cell a9, is a value that
determines the colour of the shape.. and this works fine... the
question is, how do i modify this code so that i can add other shapes
to the Chart2 i.e. Freeform 11, 12 etc.. with the colour determined
from cells A10, A11 in sheet1... ?? i am trying to get a map of the uk
- by region - to change colour depending the status (number value) in a
cell....
any help.. REALLY appreciated...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myColor As Long
Dim myShape As Shape
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("a9")) Is Nothing Then Exit Sub
' chart object not worksheet
Set myShape = Charts("Chart2").Shapes("Freeform 13")
' non textual comparison
Select Case Target.Value
Case Is > 1: myColor = 53
Case Is < 1: myColor = 33
Case Is = 1: myColor = 25
Case Else
myColor = 0
End Select
If myColor = 0 Then
myShape.Fill.Visible = False
Else
With myShape.Fill
.Visible = True
.ForeColor.SchemeColor = myColor
End With
End If
End Sub
cheers
P
Can anybody please help... i have the code below that changes the Shape
(Freeform 13) on a Chart2 tab, in Sheet1 in cell a9, is a value that
determines the colour of the shape.. and this works fine... the
question is, how do i modify this code so that i can add other shapes
to the Chart2 i.e. Freeform 11, 12 etc.. with the colour determined
from cells A10, A11 in sheet1... ?? i am trying to get a map of the uk
- by region - to change colour depending the status (number value) in a
cell....
any help.. REALLY appreciated...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myColor As Long
Dim myShape As Shape
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("a9")) Is Nothing Then Exit Sub
' chart object not worksheet
Set myShape = Charts("Chart2").Shapes("Freeform 13")
' non textual comparison
Select Case Target.Value
Case Is > 1: myColor = 53
Case Is < 1: myColor = 33
Case Is = 1: myColor = 25
Case Else
myColor = 0
End Select
If myColor = 0 Then
myShape.Fill.Visible = False
Else
With myShape.Fill
.Visible = True
.ForeColor.SchemeColor = myColor
End With
End If
End Sub
cheers
P