count cell with color

泄露秘密 提交于 2019-12-02 08:38:58

Follow the instructions on the link below with the mentioned change below the link.

https://support.microsoft.com/en-us/kb/2815384

Change: Change the script given in the link to the following, as the script from microsoft uses color index which may count other shades of a color.

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!