Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Gary
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
PDUK1
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Gary
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Gary
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I total only numbers with a specific font color? BLillie11 Excel Discussion (Misc queries) 1 December 20th 05 04:34 AM
How do I change the font color based on results of an IF stateme MKLeisure Excel Worksheet Functions 2 December 16th 05 03:53 PM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM
calculate numbers based on font color? Costa Excel Worksheet Functions 1 September 5th 05 03:59 PM
can i chart my data in the font color? larry Charts and Charting in Excel 1 June 11th 05 03:57 PM


All times are GMT +1. The time now is 05:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"