count cell with color

后端 未结 1 1221
执念已碎
执念已碎 2021-01-28 23:50

I want to count number of cell filled with specific color.

For ex. Few cell are red, few are green few are yellow.

Now I want to count total red/green/yellow.

相关标签:
1条回答
  • 2021-01-29 00:40

    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
    
    0 讨论(0)
提交回复
热议问题