cell properties and cell functions

S

Steve Curtis

Is there a way to do basically a reverse of the conditional formatting -
where the certain cells have a pattern assigned to them already, and is there
a way to in another column have that change to either a numeric value or even
a true false.

Like if cell A1 has a red background have B1 come up with sometype of a
number that would be different that if the background was blank.
 
E

EdMac

Why not use the value that has caused the other cell to come up red.

So if your conditional formatting for A1 depends on say the content
being greater than 10, then using an if statement in B1 to insert the
value you want =if(A1>10,Value you want).

Ed
 
S

Steve Curtis

Because there are not values that caused the coloring - that was entered by
hand
 
B

Bob Phillips

Then it isn't conditional formatting.

You will need a function, like this

Function CI(rng as Range)
If rng.Count > 1 Then
CI = cvErr(xlErrRef)
Else
Ci = rng.Interior.Colorindex
End If
End Function

and in your cell, use

=IF(CI(A1)=3,99,100)

which tests for Red.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
S

Steve Curtis

Thanks Bob, that works great - but here is another question - I know that the
3 is for Red, how do I find out what the other related numbers are for other
colors?
 
S

Steve Curtis

Thanks Bob, the other question I had, is how do you get this to update those
equations or to re-calculate when you change the colors of the cells? I did
check to make sure that my recalc is set to automatic already.
 
B

Bob Phillips

There is the big problem. Unfortunately, changing a cell colour does not
trigger any event, so there is no automated way. The best we can do is to
add this to the start of the function

Application.Volatile

and then when you change a colour, hit the F9 key.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Top