.FormatConditions.Count with multiple cells

  • Thread starter Thread starter zofficedepot
  • Start date Start date
Z

zofficedepot

Perhaps this is a Bob Phillips specialty. My testing has indicated
that this returns one, zero, or negative one:
1 All in range have condition(s).
0 None in range have condition(s).
-1 Some but not all in range have condition(s).
Is that reliable? I'm aiming to check .UsedRange if any exist.

There are tons of web examples with "FormatConditions.Count > 0" but
they better be referring to a single cell! It seems nobody uses it
with multiple cells.
 
You'll also get -1 if all cells in the range have conditions, but they
are different conditions.

If all cells in a range have the SAME two conditions, you'll get 2.
Likewise with 3.

To check the UsedRange, any non-zero result indicates that SOME
conditions exist.
 
Well done. Awesome - you really drilled in there! While I know that
you and some of the MVP legends give terrific and accurate info here,
I wonder if there is an "official" explanation in case anyone asks?

Thanks. Thanks a million!
 
If all cells in a range have the SAME two conditions, you'll get 2.
Likewise with 3.

Relax, I wasn't trying to trip you up on the last post, or of course
this one, but...I copied a cell to an adjacent one, selected the pair
and named as foo, and
?range("foo").FormatConditions.Count
1
shows in the immediate window. It seems we're describing two
different situations. Could you give an example of the case that
returns "2"? Mine has single condition in both: Cell value, not equal,
="ok" in each.

Thanks again.
 
Could you give an example of the case that

Doooooh - never mind. You were clear, and I didn't read it carefully,
but I got it now. You were referring to multiple conditions in each
cell. Sorry!
 
Back
Top