Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Counting cells with colored font

Hi,I know this can be done with Excel 2003 onwards, but I've got 2002 and I
can't find a way to count the cells in a range which have blue font and which
ones have red font.
Any ideas?
Range is C5:E17
--
tia
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Counting cells with colored font

This worked for me, just select a fixed cell and color code it so it knows
what color to refer to in the function. Add this macro to your visual basic..

Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As
Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult

''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com

'Sums or counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''

lCol = rColor.Interior.ColorIndex

If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If

ColorFunction = vResult
End Function
--
Thanks!
Loretta


"JockW" wrote:

Hi,I know this can be done with Excel 2003 onwards, but I've got 2002 and I
can't find a way to count the cells in a range which have blue font and which
ones have red font.
Any ideas?
Range is C5:E17
--
tia

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Counting cells with colored font

Hi Loretta, thanks for the reply. i'm not sure what you mean though!
How would the code know which cell to refer to, where would the result be
displayed.? Sorry to be a pain
Cheers
--
tia


"Loretta" wrote:

This worked for me, just select a fixed cell and color code it so it knows
what color to refer to in the function. Add this macro to your visual basic..

Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As
Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult

''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com

'Sums or counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''

lCol = rColor.Interior.ColorIndex

If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If

ColorFunction = vResult
End Function
--
Thanks!
Loretta


"JockW" wrote:

Hi,I know this can be done with Excel 2003 onwards, but I've got 2002 and I
can't find a way to count the cells in a range which have blue font and which
ones have red font.
Any ideas?
Range is C5:E17
--
tia

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
Counting colored cells Bob59 Excel Discussion (Misc queries) 2 May 20th 08 08:33 AM
Cannot see colored font is not visable. SALLY DILEONARDO Excel Worksheet Functions 1 May 27th 07 03:51 AM
Counting all cells with red font in Excel Zakynthos Excel Worksheet Functions 2 April 25th 07 02:46 PM
counting colored cells James P Excel Discussion (Misc queries) 2 June 14th 06 05:39 PM
Counting Colored cells in a database Kelly Lim Excel Discussion (Misc queries) 8 June 1st 05 11:10 AM


All times are GMT +1. The time now is 04:16 PM.

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

About Us

"It's about Microsoft Excel"