Hello Rexwrx,
Wrap your code using the # tags or your post may get locked. The first thing to do is rename your arrows. This removes the code dependence of using the system name and having use that name in your code. Name them "Up Arrow", "Down Arrow", and "Horiz Arrow" instead of "AutoShape 10" etc. Select the shape and the name will appear in the Worksheet Name Box in the upper left corner. Click in the box, type the name you want, and hit the Enter key. Tour code can be shorten as well...
Private Sub Worksheet_Change(ByVal Target1 As Excel.Range)
Dim trend As String
On Error GoTo WkSheet_Change_Err
'overall
If (Target1.Address = "$C$5") Then
Call changeTrend(Target1, "Down Arrow")
End If
'assets & liabilities
If (Target1.Address = "$C$16") Then
Call changeTrend(Target1, "Horiz Arrow")
End If
Sub changeTrend(ByVal Target1 As Excel.Range, ShapeName As String)
Dim ShapeColor As Long
trend = Target1.Value
Select Case trend
Case "G"
ShapeColor = 11 'green
Case "R"
ShapeColor = 10 'red
Case "A"
ShapeColor = 52 'orange
Case Else
Exit Sub
End Select
With ActiveSheet.Shapes(ShapeName)
.Fill.BackColor.SchemeColor = ShapeColor
.Visible = True
End With
End Sub
Sincerely,
Leith Ross
Bookmarks