Using VBA to apply conditional formatting to a range of cells Using VBA to apply conditional formatting to a range of cells vba vba

Using VBA to apply conditional formatting to a range of cells


You need to do something like this (Range("A25") is exactly what you are going to find):

With Range("A25")        .FormatConditions.Delete        .FormatConditions.Add Type:=xlExpression, _            Formula1:="=" & c.Address         '.        '.        '.End With

and there is no need to write "=" & c.Address & "=TRUE", you can use just "=" & c.Address.


The "applies to" is inherent in the Selection that the With block is performed on.