答案 0 :(得分:2)
按照以下链接上的说明,在链接下方提及更改。
https://support.microsoft.com/en-us/kb/2815384
更改:将链接中指定的脚本更改为以下内容,因为microsoft中的脚本使用的颜色索引可能会计算其他颜色的颜色。
Function CountColor(range_data As range, criteria As range) As Long
Dim datax As range
Dim xcolor As Long
xcolor = criteria.Interior.color
For Each datax In range_data
If datax.Interior.color = xcolor Then
CountColor = CountColor + 1
End If
Next datax
End Function