View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Enter a value dependant on the colour of a cell

You need a simple UDF

Function ColorIndex(rng As Range)
If rng.Cells.Count 1 Then
ColorIndex = CVErr(xlErrRef)
Else
ColorIndex = rng.Interior.ColorIndex
End If
End Function

and use that in the worksheet like so

=If(ColorIndex(B2)=6,"YES","")

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"cdb" wrote in message
...
I have a spreadsheet that has been partially filled by someone else. They
have filled in all cells relating to a certain condition with the

background
colour of yellow. Unfortunately this is the only indicator he has used,

and I
now need to filter based on the colour selection.

What I am wanting to do is enter a value in a cell dependant on the colour
of a different cell. What I mean by this is that if the background colour

of
B2 is yellow, put YES in A2 and so on down the rows.

Can anyone offer me some advice on this?

Cheers,

cdb