gino59
Active Member
- Joined
- Jul 26, 2010
- Messages
- 496
Hi all,
The following code should change the color of the shape based on the positive/negative value found in cell C11. Most times, this code works but not always and I'm stumped as to why.
Any ideas? Suggestions on cleaning it up or improving it? I'd just like it to consistently change the shape color correctly!
Many thanks as always!
Gino
The following code should change the color of the shape based on the positive/negative value found in cell C11. Most times, this code works but not always and I'm stumped as to why.
Any ideas? Suggestions on cleaning it up or improving it? I'd just like it to consistently change the shape color correctly!
Many thanks as always!
Gino
Code:
' +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' The user selects a date from the Calendar1 control to view all transactions for that
' date. The table on the worksheet sums the transaction values and places the sum value
' in cell $C$11. The value of $C$11 is entered into a text box which is grouped with the
' "Information Shape". If the value in cell $C$11 is negative, change the color of the
' "Information Shape" to red. If positive or zero, change it to green.
' +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'
Private Sub Worksheet_Calculate()
If Worksheets("Report").Range("$M$11").Value = "$0.00" Then
Worksheets("Report").Shapes.Range(Array("Group 14")).Fill.ForeColor.SchemeColor = 17
End If
If Worksheets("Report").Range("$M$11").Value < 0 Then
Worksheets("Report").Shapes.Range(Array("Group 14")).Fill.ForeColor.SchemeColor = 16
Else
Worksheets("Report").Shapes.Range(Array("Group 14")).Fill.ForeColor.SchemeColor = 17
End If
End Sub