P
peedub
I have a series of non-contiguous rows that I want to apply
conditional formatting to. Right now, my code snip looks like this:
With Range(sBegRange, sEndRange)
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=" & sCFCell & ">40"
.FormatConditions(i).Font.Color = 3
.FormatConditions(i).StopIfTrue = False
End With
Where sCFCell is a string value for the cell I want evaluated for the
formula, and i is an integer that increments for each time I create a
new rule (which I'm doing for each row I format).
It's currently breaking on the .FormatConditions(i).Font.Color = 3
line, with an error reading "Application-defined or object-defined
error", error 1004. I'm guessing it doesn't like the "FormatConditions
(i)" part, so how do I get around this? How can I dynamically identify
a set of rows to build a single rule for? Is it possible to build the
rule the first time, then keep appending the new range of cells for
the rule to apply to?
conditional formatting to. Right now, my code snip looks like this:
With Range(sBegRange, sEndRange)
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=" & sCFCell & ">40"
.FormatConditions(i).Font.Color = 3
.FormatConditions(i).StopIfTrue = False
End With
Where sCFCell is a string value for the cell I want evaluated for the
formula, and i is an integer that increments for each time I create a
new rule (which I'm doing for each row I format).
It's currently breaking on the .FormatConditions(i).Font.Color = 3
line, with an error reading "Application-defined or object-defined
error", error 1004. I'm guessing it doesn't like the "FormatConditions
(i)" part, so how do I get around this? How can I dynamically identify
a set of rows to build a single rule for? Is it possible to build the
rule the first time, then keep appending the new range of cells for
the rule to apply to?