#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 33
Default Color

Is is possible to define a condition depending of the text color of cells ?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Color

This may give you what you want:
Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = 3)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function

Code is from:
http://www.cpearson.com/excel/colors.htm

Call it in the following manner:
=CountByColor(A1:F5,3,TRUE)
Notice, this is for text colored red, which Excel recognizes as 3.

Regards,
Ryan---

--
RyGuy


"Angeles" wrote:

Is is possible to define a condition depending of the text color of cells ?

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Color

Only through VBA

You need a function to determine the font color then use that font color index
number as the criterion for the condition.

For more on color functions see Chip Pearson's site.

http://www.cpearson.com/excel/colors.htm


Gord Dibben MS Excel MVP

On Wed, 28 Nov 2007 10:23:01 -0800, Angeles
wrote:

Is is possible to define a condition depending of the text color of cells ?

Thank you


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 36
Default Color

Create a defined name (INSERT ~ NAME ~ DEFINE)

Call it something like CELLCOLOUR and in the Refers to: box enter:
=GET.CELL(24,INDIRECT(ADDRESS(0,0,4,FALSE),FALSE))
Which will return the font colour index of the current cell.

Can then be used in a formula:
=IF(CellColour=3,"Red","Something else")

More help on GET.CELL:
http://www.mrexcel.com/archive2/18800/21312.htm

http://www.jkp-ads.com/Articles/ExcelNames08.htm


"Angeles" wrote:

Is is possible to define a condition depending of the text color of cells ?

Thank you

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 33
Default Color

Thank you very much all of you.



"Darren Bartrup" wrote:

Create a defined name (INSERT ~ NAME ~ DEFINE)

Call it something like CELLCOLOUR and in the Refers to: box enter:
=GET.CELL(24,INDIRECT(ADDRESS(0,0,4,FALSE),FALSE))
Which will return the font colour index of the current cell.

Can then be used in a formula:
=IF(CellColour=3,"Red","Something else")

More help on GET.CELL:
http://www.mrexcel.com/archive2/18800/21312.htm

http://www.jkp-ads.com/Articles/ExcelNames08.htm


"Angeles" wrote:

Is is possible to define a condition depending of the text color of cells ?

Thank you

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't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 01:41 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM
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
Excel 2003 will not display color fonts or color fill cells DaveC Excel Worksheet Functions 1 April 11th 05 04:38 PM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM


All times are GMT +1. The time now is 05:58 PM.

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"