G
Guest
I'm new to this but I have finally hacked out something that does what I want
by using a basic template from another user. My code is at the bottom of the
message.
This changes the fill of the identified shapes based upon some value.
The first line of the code: "Private Sub Worksheet_Change(ByVal Target As
Range)"
was included in the template. I don't know if this is just a title, whether
it has some specific syntax or format or what.
I also cannot find a list of Me.Shapes. "Face" is a smiley face that was
included in the template and "Auto Shape 2" is a shape that I added using the
draw tool. It seems that somewhere in Excel I should be able to find a list
of these shapes and that there should be a way to rename the AutoShapes to
something more meaningful like you would with a range name.
Any help will be appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Shapes("Face").Select
With Range("FaceInd")
If .Value <= 3 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf .Value > 3 And .Value <= 6 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 254, 0)
Else
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(88, 146, 0)
End If
.Select
End With
Me.Shapes("AutoShape 2").Select
With Range("AutoShape2ID")
If .Value <= 3 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf .Value > 3 And .Value <= 6 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 254, 0)
Else
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(88, 146, 0)
End If
.Select
End With
End Sub
by using a basic template from another user. My code is at the bottom of the
message.
This changes the fill of the identified shapes based upon some value.
The first line of the code: "Private Sub Worksheet_Change(ByVal Target As
Range)"
was included in the template. I don't know if this is just a title, whether
it has some specific syntax or format or what.
I also cannot find a list of Me.Shapes. "Face" is a smiley face that was
included in the template and "Auto Shape 2" is a shape that I added using the
draw tool. It seems that somewhere in Excel I should be able to find a list
of these shapes and that there should be a way to rename the AutoShapes to
something more meaningful like you would with a range name.
Any help will be appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Shapes("Face").Select
With Range("FaceInd")
If .Value <= 3 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf .Value > 3 And .Value <= 6 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 254, 0)
Else
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(88, 146, 0)
End If
.Select
End With
Me.Shapes("AutoShape 2").Select
With Range("AutoShape2ID")
If .Value <= 3 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf .Value > 3 And .Value <= 6 Then
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 254, 0)
Else
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(88, 146, 0)
End If
.Select
End With
End Sub