Value of a cell in a range if color is yellow

  • Thread starter Dominique Feteau
  • Start date
D

Dominique Feteau

I searched the board for the answer to this question and went to
http://www.cpearson.com/excel/colors.htm to see if i could find what i
needed but to no avail. What I need is a function that will look in a
range, (which are months formatted as mmm-yy) and give me the value of that
cell that is yellow. I did get some code, but it comes up as a message box.
I'd rather have it as a formula i can stick in a cell and have it return an
value. so if in the range b12:m12, j12 is yellow, i'd like to have the
value of j12 in a cell.

Sub yellowvalue()
For Each c In [b12:m12]
If c.Interior.ColorIndex = 6 Then MsgBox c
Next
End Sub

Can anyone help me out?

Dominique
 
D

Don Guillett

Yes, I'm the one that gave you the original code. Just modify to:If c.Interior.ColorIndex = 6 Then [a2].value=c
--
Don Guillett
SalesAid Software
(e-mail address removed)
Dominique Feteau said:
I searched the board for the answer to this question and went to
http://www.cpearson.com/excel/colors.htm to see if i could find what i
needed but to no avail. What I need is a function that will look in a
range, (which are months formatted as mmm-yy) and give me the value of that
cell that is yellow. I did get some code, but it comes up as a message box.
I'd rather have it as a formula i can stick in a cell and have it return an
value. so if in the range b12:m12, j12 is yellow, i'd like to have the
value of j12 in a cell.

Sub yellowvalue()
For Each c In [b12:m12]
If c.Interior.ColorIndex = 6 Then MsgBox c
Next
End Sub

Can anyone help me out?

Dominique
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top