Alec wrote
How do I modify it to remove format condition 2, the
following does not work:-
"Selection.FormatConditions(2).Delete
This should work. I tested it using this procedure:
sub test()
'Remove any exsisting conditons on the selection
Selection.FormatConditions.Delete
'Add three new conditons. 3 is the maximum allowed
Selection.FormatConditions.Add xlCellValue, xlLess, "=$A$1"
Selection.FormatConditions(1).Font.ColorIndex = 3 'Red
Selection.FormatConditions.Add xlCellValue, xlNotEqual, "=$B$1"
Selection.FormatConditions(1).Font.ColorIndex = 6 'Yellow
Selection.FormatConditions.Add xlCellValue, xlGreater, "=$c$1"
Selection.FormatConditions(1).Font.ColorIndex = 54 'Purple
'Comment the next line out to prove Selection.FormatConditions(2).Delete works
'If the values of A1 = 1, B1 = 2 , C1 = 3 and this macro is run with A2
'selected an input of 2 will either make the font yellow or not depending on
'wether FormatConditions(2).Delete has run.
Selection.FormatConditions(2).Delete
end sub
HTH
Nigel