View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TheRook TheRook is offline
external usenet poster
 
Posts: 57
Default VBA counting colors, errors

Sorry, people need Extra Sensory perception when i post. Module is as below:

Function CountCol(SumRange As Range, intColor As Integer) As Integer
Dim i As Integer
Dim Cell As Range

Set SumRange = SumRange.SpecialCells(xlCellTypeAllFormatCondition s)

For Each Cell In SumRange
If Cell.Interior.ColorIndex = intColor Then
i = i + 1
End If

Next Cell

CountCol = i

End Function


"Bob Phillips" wrote:

Which module?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"TheRook" wrote in message
...
I am currently having 2 problems.
1. If an additional line in inserted with a specific color the count does
not automatically refresh. Can a loop be put in?

2. If I delete a row the function reports NAME#. Can something be added

to
the module to exclude deleted rows?

regards