Count no. of Cell with particular color in a row/Column

December 2016


Here i am defining a function for counting a no. of cell in a Row/Column with particular color,

It is just like Countif cellcolor is = Color

Function ColorCount(colorCell As Range, countRange As Range)   
Dim rCell As Range   
Dim cellCol As Integer   
Dim ans As Long   
ans = 0   
cellCol = colorCell.Interior.ColorIndex   
For Each rCell In countRange   
If rCell.Interior.ColorIndex = cellCol Then   
ans = ans + 1   
End If   
Next rCell   

ColorCount = ans   

End Function   

Related :

This document entitled « Count no. of Cell with particular color in a row/Column » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.