I have the following code working perfectly, but need to add one thing. If the current cell is blank I want the select case code to be ignored. Can you help?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oCell As Range
For Each oCell In Range("I10:Z22")
myTot = oCell.Value
For i = 1 To 5
myTot = myTot + oCell.Offset(0, -i).Value
Next i
Select Case myTot
Case Is < 3
oCell.Interior.ColorIndex = xlNone
Case Is = 3
oCell.Interior.ColorIndex = 6
Case Is = 4
oCell.Interior.ColorIndex = 45
Case Is = 5
oCell.Interior.ColorIndex = 3
Case Is > 5
oCell.Interior.ColorIndex = 39
End Select
Next oCell
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oCell As Range
For Each oCell In Range("I10:Z22")
myTot = oCell.Value
For i = 1 To 5
myTot = myTot + oCell.Offset(0, -i).Value
Next i
Select Case myTot
Case Is < 3
oCell.Interior.ColorIndex = xlNone
Case Is = 3
oCell.Interior.ColorIndex = 6
Case Is = 4
oCell.Interior.ColorIndex = 45
Case Is = 5
oCell.Interior.ColorIndex = 3
Case Is > 5
oCell.Interior.ColorIndex = 39
End Select
Next oCell
End Sub