counting cells?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top