GoKats78
06-23-2009, 04:04 AM
Column 2 is a calculated value (a sum of several other columns). I cannot get the code to work. When I enter the same value in the field it works, but not when it is a calulated value.
I know there must be a simple error in here somewhere...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 Then
Select Case Target.Value
Case Is > 382: Target.Offset(0, 0).Interior.ColorIndex = 3: Target.Offset(0, 0).Font.ColorIndex = 2
Case Is > 315: Target.Offset(0, 0).Interior.ColorIndex = 30: Target.Offset(0, 0).Font.ColorIndex = 2
Case Is > 180: Target.Offset(0, 0).Interior.ColorIndex = 46: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
Case Is > 112: Target.Offset(0, 0).Interior.ColorIndex = 4: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
Case Is > 45: Target.Offset(0, 0).Interior.ColorIndex = 26: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
Case Else: Target.Offset(0, 0).Interior.ColorIndex = xlNone: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
End Select
End If
I know there must be a simple error in here somewhere...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 Then
Select Case Target.Value
Case Is > 382: Target.Offset(0, 0).Interior.ColorIndex = 3: Target.Offset(0, 0).Font.ColorIndex = 2
Case Is > 315: Target.Offset(0, 0).Interior.ColorIndex = 30: Target.Offset(0, 0).Font.ColorIndex = 2
Case Is > 180: Target.Offset(0, 0).Interior.ColorIndex = 46: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
Case Is > 112: Target.Offset(0, 0).Interior.ColorIndex = 4: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
Case Is > 45: Target.Offset(0, 0).Interior.ColorIndex = 26: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
Case Else: Target.Offset(0, 0).Interior.ColorIndex = xlNone: Target.Offset(0, 0).Font.ColorIndex = xlAutomatic
End Select
End If