this should do it......
for i = 13 to RowCount ' starting from 13 as per your example
Range.Cells(i,4).Select ' this is cell D13
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue
Operator:=xlEqual, _
Formula1:="=""x"""
Selection.FormatConditions(1).Font.ColorIndex = xlAutomatic
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(" & Range.cells(i,4).address & ":"
Range.cells(i,17).address & ",""A"")=2"
Selection.FormatConditions(2).Font.ColorIndex = 46
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(" & Range.cells(i,4).address & ":"
Range.cells(i,17).address & ",""A"")=3"
Selection.FormatConditions(3).Font.ColorIndex = 3
Next
- Manges
--
Message posted from
http://www.ExcelForum.com