ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value of a cell in a range if color is yellow (https://www.excelbanter.com/excel-programming/287420-value-cell-range-if-color-yellow.html)

Dominique Feteau

Value of a cell in a range if color is yellow
 
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



Don Guillett[_4_]

Value of a cell in a range if color is yellow
 
Yes, I'm the one that gave you the original code. Just modify to:
If c.Interior.ColorIndex = 6 Then MsgBox c

If c.Interior.ColorIndex = 6 Then [a2].value=c
--
Don Guillett
SalesAid Software

"Dominique Feteau" wrote in message
...
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






All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com