Private Sub Worksheet_Change(ByVal
Target As Range)
'A1:A10
'0-10 Background = red(3)
'>10-20 Background = orange(44)
'>20-30 Background = yellow(6)
'>30-40 Background = green(4)
'>40-50 Background = blue(5)
'>50 Background = purple(21)
'D1:D10
'<0 Font = red(3)
background = white(2)
'0-100 Font = white(2)
background = black(1)
'100-<500 Font = black(1)
background = green(4)
'500-<1000 Font = green(4)
background = black(1)
'>1000 Font = black(1)
background = red(3)
Dim cel As Range
For Each cel In
Range("A1:A10").Cells
If IsNumeric(cel.Value) And
cel.Value <> "" Then
If cel.Value >= 0 And
cel.Value <= 10 Then
cel.Interior.ColorIndex
= 3
ElseIf cel.Value > 10 And
cel.Value <= 20 Then
cel.Interior.ColorIndex
= 44
ElseIf cel.Value > 20 And
cel.Value <= 30 Then
cel.Interior.ColorIndex
= 6
ElseIf cel.Value > 30 And
cel.Value <= 40 Then
cel.Interior.ColorIndex
= 4
ElseIf cel.Value > 40 And
cel.Value <= 50 Then
cel.Interior.ColorIndex
= 5
ElseIf cel.Value > 50 Then
cel.Interior.ColorIndex
= 21
Else 'default conditions
cel.Interior.ColorIndex
= 0
cel.Font.ColorIndex = 1
End If
Else
cel.Interior.ColorIndex = 0
cel.Font.ColorIndex = 1
End If
Next
For Each cel In
Range("D1:D10").Cells
If IsNumeric(cel.Value) And
cel.Value <> "" Then
If cel.Value < 0 Then
cel.Font.ColorIndex = 3
cel.Interior.ColorIndex
= 0
ElseIf cel.Value < 100 Then
cel.Font.ColorIndex = 2
cel.Interior.ColorIndex
= 1
ElseIf cel.Value < 500 Then
cel.Font.ColorIndex = 1
cel.Interior.ColorIndex
= 4
ElseIf cel.Value < 1000
Then
cel.Font.ColorIndex = 4
cel.Interior.ColorIndex
= 1
Else '>=1000
cel.Font.ColorIndex = 1
cel.Interior.ColorIndex
= 3
End If
Else
cel.Font.ColorIndex = 1
cel.Interior.ColorIndex = 0
End If
Next
End Sub