PDA

View Full Version : How to count the cells in excel with different fill pattern styles


sriku24
Jun 6, 2008, 12:38 AM
Hi

I want to count the cells in excel with different fill pattern styles.

How is it possible. Can anyone post the function for this purpose like counting coloured cells.

I tried a lot , but I got failed.

Here I got a function to count cells filled solid, but it is not working... is it correct??

Function CountCellpattern(CellPat As Range, rSumRange As Range)

Dim rCell As Range
Dim iPat As Integer
Dim vResult

iPat = CellPat.Interior.Pattern

For Each rCell In rSumRange

If iPat = 1 Then

vResult = vResult + 1
End If
Next rCell

CountCellpattern = vResult

End Function

Clough
Jun 6, 2008, 01:34 AM
I don't know if this is exactly what you are looking for, but the following site seems to have some good information concerning the counting of cells. I hope that it is helpful to you!

http://www.contextures.com/xlFunctions04.html (http://www.contextures.com/xlFunctions04.html)

ScottGem
Jun 6, 2008, 06:55 AM
What's not working? Have you tried stepping through the function?