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

February 2017

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   


Published by RWomanizer. Latest update on March 16, 2011 at 05:12 AM by RWomanizer.
This document, titled "Count no. of Cell with particular color in a row/Column," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (