View Single Post
  #5   Report Post  
Ola
 
Posts: n/a
Default

Here are a few alternatives:

=SUMPRODUCT(--(CellColor(A2:A28)=3))


VB: Alt+F11 Insert Module: (Copy and paste the below)

Public Function CellColor(myCell As Range) As Variant
Application.Volatile True
CellColor = myCell.Interior.ColorIndex
End Function

Public Function FontColor(myCell As Range) As Variant
FontColor = myCell.Font.ColorIndex
End Function

Public Function NumberFormat(Cell As Range) As String
NumberFormat = Cell.NumberFormat
End Function

Public Function FontBold(myCell As Range) As Variant
FontBold = myCell.Font.Bold
End Function

Have fun
Ola Sandstrom


Note:
You can either use Application.Volatile True or NOW()*0.
Application.Volatile True will make your spreadsheet recalculate everything
-- Excel runs slower.
=FontColor(A17)+NOW()*0 -- faster but messy formulas. In your example that
would be =SUMPRODUCT(--((FontColor(A2:A28)+NOW()*0)=3))

http://www.excelforum.com/showthread...ight=cellcolor