hello everyone i run this code and i get 2 errors
1)in range Test1 value zero is both green and red (some green other red)
2)in range Test2 more than 100 gives red font & less no condition
P.S: i have excel 2007
what am i doing wrong?(if i disable the last condition i get them green)
thanks in advance!
1)in range Test1 value zero is both green and red (some green other red)
2)in range Test2 more than 100 gives red font & less no condition
P.S: i have excel 2007
what am i doing wrong?(if i disable the last condition i get them green)
thanks in advance!
Code:
Option Explicit
Private Sub Worksheet_Calculate()
Range("Test1").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="0"
Selection.FormatConditions(1).Font.Color = -11489280
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLessEqual, Formula1:="=0"
Selection.FormatConditions(2).Font.Color = -16776961
Range("Test2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="100"
Selection.FormatConditions(1).Font.Color = -11489280
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLessEqual, Formula1:="=100"
Selection.FormatConditions(2).Font.Color = -16776961
End Sub