Is there a fuction that counts number of highlighted cells Excell

  • Thread starter Thread starter bstrack
  • Start date Start date
B

bstrack

I want to total the number of highlighted or specific fill color cells in a
range. The data in the cell in not my concer just the highlight or fill.
 
Call with below call. Note: The code below will not automatically update
when color get changed. Color changes do not cause a recalculation of the
spreadsheet.


=FilledCells(B7:D10)


Function FilledCells(Target As Range)
Count = 0
For Each Cell In Target
If Cell.Interior.ColorIndex <> xlNone Then
Count = Count + 1
End If
Next Cell
FilledCells = Count
 
Hi Joel, you didn't include the cell colored by conditional formatting. they
have to have the FormatCondidtions(1) thing thrown in like:

If Cell.FormatConditions(1).Interior.ColorIndex <> xlNone
 

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

Back
Top