Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Color
Is is possible to define a condition depending of the text color of cells ?
Thank you |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't format cell color/text color in Office Excel 2003 in fil | Excel Discussion (Misc queries) | |||
Can't format cell color/text color in Office Excel 2003 in files . | Excel Discussion (Misc queries) | |||
My fill color and font color do not work in Excel Std Edition 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 will not display color fonts or color fill cells | Excel Worksheet Functions | |||
My excel 2003 wont let me fill cells with color or color the tabs. | New Users to Excel |