ajay_gajree
Well-known Member
- Joined
- Jul 16, 2011
- Messages
- 518
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
If IsNumeric(Target.Value) Then
If Target.Value < 2 Then
ActiveSheet.Shapes("srRectangle1").Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf Target.Value >= 2 And Target.Value < 3 Then
ActiveSheet.Shapes("srRectangle1").Fill.ForeColor.RGB = RGB(255, 192, 0)
Else
ActiveSheet.Shapes("srRectangle1").Fill.ForeColor.RGB = RGB(0, 255, 0)
End If
End If
End Sub
Hi All
I have the above code which changes the colour of a shape, srRectangle1 based on a cell value, A1
If I want to do the same for shape srRectangle2 based on cell value A2, is there a more efficient way than repeating the entire code and changing those values?
Ultimately I have 50 odd shapes in the same worksheet al looking at different cell values, so looking to avoid 50 change events!
Any help appreciated!