PC Review


Reply
Thread Tools Rate Thread

how I can Check the color of font in excel cell ?

 
 
=?Utf-8?B?aW0tRUdZ?=
Guest
Posts: n/a
 
      21st Sep 2006
Can I set a cell to equal 1 for a font colored "RED" in another cell , such as:
if cell B1 is "RED" font colored i need cell C1 to be =1
Thanks

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxhdGhhbQ==?=
Guest
Posts: n/a
 
      21st Sep 2006
As far as I know, you cannot test font color with a worksheet function. You
can do so in VBA code like
If Range("B1").Font.ColorIndex = 3 Then
Range("C1") = 1
End If

If the font color in B1 is controlled by conditional formatting, you could
set up a similar test for value in C1.

Lets say you used Conditional Formatting in B1 to set font color to red when
its value is greater than 100, then in C1 you could use similar logic with an
IF function:
=IF(B1>100,1,0)



"im-EGY" wrote:

> Can I set a cell to equal 1 for a font colored "RED" in another cell , such as:
> if cell B1 is "RED" font colored i need cell C1 to be =1
> Thanks
>

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      21st Sep 2006
If you add this Chip Pearson UDF to amodule in your workbook you can construct a
formula.

Function CellColorIndex(inRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the Interior
' (background) of a cell, or, if OfText is true, of the Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = inRange.Font.ColorIndex
Else
CellColorIndex = inRange.Interior.ColorIndex
End If
End Function

In C1 enter =IF(cellcolorindex(B1,TRUE)=3,1,"")


Gord Dibben MS Excel MVP

On Thu, 21 Sep 2006 03:16:01 -0700, im-EGY <(E-Mail Removed)>
wrote:

>Can I set a cell to equal 1 for a font colored "RED" in another cell , such as:
>if cell B1 is "RED" font colored i need cell C1 to be =1
>Thanks


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way for excel to change the font color in a cell if I t Eric Microsoft Excel Worksheet Functions 1 4th Nov 2008 02:15 AM
Check Font or Font color and take action =?Utf-8?B?TVNQTGVhcm5lcg==?= Microsoft Excel Programming 3 15th Nov 2006 11:31 AM
How do you set the font color in an EXCEL cell? =?Utf-8?B?RGFycmVsbCBXZXNsZXk=?= Microsoft VB .NET 8 11th Nov 2004 01:38 PM
Excel should allow functions based on cell or font color without . =?Utf-8?B?c2ltcGx5X2dpcmxfOTMyMQ==?= Microsoft Excel Worksheet Functions 2 18th Oct 2004 09:45 AM
Excel - Calculating total based on different font color of the cell eric Microsoft Excel Worksheet Functions 1 11th Jul 2003 05:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:18 PM.