Chip Pearson has a lot of info on counting colors at this site:
http://www.cpearson.com/excel/colors.aspx
"Phil H" <(E-Mail Removed)> wrote in message
news:02975D2F-56E6-4376-8755-(E-Mail Removed)...
> Luke,
>
> I put this (corrected) function code in a new module 3 in personal.xls and
> used the following cell formula: =COUNTYELLOW(A2:A6935), and get a #Name?
> error in the cell.
>
> "Luke M" wrote:
>
>> Correction, change this line:
>>
>> Application.Volatile = True
>>
>> to just
>>
>> Application.Volatile
>>
>> --
>> Best Regards,
>>
>> Luke M
>> *Remember to click "yes" if this post helped you!*
>>
>>
>> "Luke M" wrote:
>>
>> > You can use this short UDF called CountYellow. Note that it only counts
>> > true
>> > background color, not format generated by conditional formatting.
>> > Detecting
>> > conditional formatting is quite a bit more complicated...
>> >
>> > Public Function CountYellow(r As Range) As Double
>> > Application.Volatile = True
>> >
>> > CountColor = 0
>> > For Each c In r
>> > If c.Interior.ColorIndex = 6 Then
>> > CountColor = CountColor + 1
>> > End If
>> > Next
>> >
>> > End Function
>> > --
>> > Best Regards,
>> >
>> > Luke M
>> > *Remember to click "yes" if this post helped you!*
>> >
>> >
>> > "Phil H" wrote:
>> >
>> > > Need a formula to count the cells in a range with a background color
>> > > yellow
>> > > (6).