1,按背景颜色统计个数
Function Countcolor(col As Range, countrange As Range)
Dim icell As Range
Application.Volatile
For Each icell In countrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
Countcolor = Countcolor + 1
End If
Next icell
End Function
![](http://imgsrc.baidu.com/forum/w%3D580/sign=dccb81b633adcbef01347e0e9cae2e0e/873f21ec08fa513d2afed4ac3f6d55fbb3fbd998.jpg)
Function Countcolor(col As Range, countrange As Range)
Dim icell As Range
Application.Volatile
For Each icell In countrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
Countcolor = Countcolor + 1
End If
Next icell
End Function
![](http://imgsrc.baidu.com/forum/w%3D580/sign=dccb81b633adcbef01347e0e9cae2e0e/873f21ec08fa513d2afed4ac3f6d55fbb3fbd998.jpg)