HI,
I am new to Excel VBA programming and assigned to Excel VBA support project to work to increase the performance of excel with VBA programming.
I want to make an Autoshape change colour with value in side.
<80% Red
>=80% to 100%< yellow
>100% green
And the code I'm using is
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2")) Is Nothing Then
If IsNumeric(Target.Value) Then
If Target.Value < 0.8 Then
ActiveSheet.Shapes("test1").Fill.ForeColor.RGB = vbRed
ElseIf Target.Value >= 0.8 And Target.Value < 1 Then
ActiveSheet.Shapes("test1").Fill.ForeColor.RGB = vbYellow
Else
ActiveSheet.Shapes("test1").Fill.ForeColor.RGB = vbGreen
End If
End If
End If
End Sub
The code works but one has to click in the cell value and press enter for the colour to change, this happens because the value of cell A2 is =Home!A2.
Can you help me to make the code work directly from Home!A2 or make this code work so that I don't have to click in the cell value and enter.
Bookmarks