counting cells?

G

Guest

Hi,
it´s possible, in excel 2003, using a function, counting the number of cells
in a colum that have text in black and text in red charaters.
ex: colum "payment"; (B5:B56); and counting employees in black text, and
employee in red text???
thanks.
alberto
 
G

Guest

Yes it is possible but it doesn't automatically get updated. Changing colors
to not produce an event that will update a worksheet. You can use the
functtion below.

call with =countcolors(Range, color)
red = 3 and black = 1, but you can use any color.


Function CountColors(ByVal Target As Range, Color As Integer)

CountColors = 0
For Each cell In Target

If cell.Interior.ColorIndex = Color Then
CountColors = CountColors + 1

End If
Next cell

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top