We have a color-coded visual schedule, but need to count the cells of a
common color to determine if we have allocated enough resources to a
particular task. Please note that the assigned colors are related to a
certain task (in a legend) and are often custom colors not chosen directly
from the standard palette.
However, Chip Pearson shows how it can be done with a bit of VBA here:
http://www.cpearson.com/excel/colors.aspx
Hope this helps.
Pete
Select the range of cells then Edit>Find>Format>Choose from cell>Select a
cell from the custom colors legend>OK
In "Found" dialog hit CTRL + a.
Right-click on Status Bar and "Count"
Gord Dibben MS Excel MVP
Thanks,
Richard
"Gord Dibben" <gorddibbATshawDOTca> wrote in message
news:vk51o49gvupnnqvsp...@4ax.com...
Sincerely,
Richard
************************
"Pete_UK" <pash...@auditel.net> wrote in message
news:b87e2ef1-6206-4cac...@a12g2000pro.googlegroups.com...
Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
Dim rng As Range
Application.Volatile True
For Each rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(rng.Interior.ColorIndex = WhatColorIndex)
End If
Next rng
End Function
Copy/paste the UDF to a general module in your workbook.
Usage is.................=COUNTBYCOLOR(range,3,FALSE)
3 is red
To see a list of colors and index numbers run this macro
Sub ListColorIndexes()
Dim Ndx As Long
Sheets.Add
For Ndx = 1 To 56
Cells(Ndx, 1).Interior.ColorIndex = Ndx
Cells(Ndx, 2).Value = Ndx
Next Ndx
End Sub
Gord
Thanks,
Richard
******************
"Gord Dibben" <gorddibbATshawDOTca> wrote in message
news:rs99o4p2u2c21qmr1...@4ax.com...
Pete
Gord