View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default conditional formatting

Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=(AD10<895)*(AD10<0)"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree wrote:
I have wrote a VBA code to add conditional formatting to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???