Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
If statement to test font color
I have seen this question in reverse on the forum. Usually the question is
to change the font color when criteria is met. I need to test the font color in order to determine value. I can do it in code with a for..next loop but I was wondering if it could be done in an if statement? Example: If(fontcolor (A2) = "Red", then "Next Day", "Standard") What would be the syntax? Thanks for the help. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
If statement to test font color
Chip has lots on colours; www.cpearson.com
best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Gary" wrote in message ... I have seen this question in reverse on the forum. Usually the question is to change the font color when criteria is met. I need to test the font color in order to determine value. I can do it in code with a for..next loop but I was wondering if it could be done in an if statement? Example: If(fontcolor (A2) = "Red", then "Next Day", "Standard") What would be the syntax? Thanks for the help. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
If statement to test font color
Try this:
Sub FontColor() MsgBox "The Font Color Index is " & ActiveCell.Font.ColorIndex End Sub If Cell.Font.ColorIndex = 3 Then xxxx Peter "Gary" wrote: I have seen this question in reverse on the forum. Usually the question is to change the font color when criteria is met. I need to test the font color in order to determine value. I can do it in code with a for..next loop but I was wondering if it could be done in an if statement? Example: If(fontcolor (A2) = "Red", then "Next Day", "Standard") What would be the syntax? Thanks for the help. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
If statement to test font color
Peter,
Thanks for the quick response. I may not have been clear. I was looking for a way to enter that same idea into a cell. Is that possible? "PDUK1" wrote: Try this: Sub FontColor() MsgBox "The Font Color Index is " & ActiveCell.Font.ColorIndex End Sub If Cell.Font.ColorIndex = 3 Then xxxx Peter "Gary" wrote: I have seen this question in reverse on the forum. Usually the question is to change the font color when criteria is met. I need to test the font color in order to determine value. I can do it in code with a for..next loop but I was wondering if it could be done in an if statement? Example: If(fontcolor (A2) = "Red", then "Next Day", "Standard") What would be the syntax? Thanks for the help. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
If statement to test font color
There is no way within a formula to determine a cell's color,
either background or foreground. You need a VBA function. See the "Returning The ColorIndex Of A Cell" on www.cpearson.com/excel/colors.htm . -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Gary" wrote in message ... I have seen this question in reverse on the forum. Usually the question is to change the font color when criteria is met. I need to test the font color in order to determine value. I can do it in code with a for..next loop but I was wondering if it could be done in an if statement? Example: If(fontcolor (A2) = "Red", then "Next Day", "Standard") What would be the syntax? Thanks for the help. |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
If statement to test font color
Chip,
Thanks for the confirmation. I thought that might be the answer but was hoping. "Chip Pearson" wrote: There is no way within a formula to determine a cell's color, either background or foreground. You need a VBA function. See the "Returning The ColorIndex Of A Cell" on www.cpearson.com/excel/colors.htm . -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Gary" wrote in message ... I have seen this question in reverse on the forum. Usually the question is to change the font color when criteria is met. I need to test the font color in order to determine value. I can do it in code with a for..next loop but I was wondering if it could be done in an if statement? Example: If(fontcolor (A2) = "Red", then "Next Day", "Standard") What would be the syntax? Thanks for the help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I total only numbers with a specific font color? | Excel Discussion (Misc queries) | |||
How do I change the font color based on results of an IF stateme | Excel Worksheet Functions | |||
My fill color and font color do not work in Excel Std Edition 2003 | Excel Discussion (Misc queries) | |||
calculate numbers based on font color? | Excel Worksheet Functions | |||
can i chart my data in the font color? | Charts and Charting in Excel |