单位统计用,编了个简单的外置函数,来实现统计单元格颜色的个数,但是发现,改变单元格颜色,函数不能自动重新计算,而且我在选项里已经选择自动重新计算,每次得按F9键才能重新计算,请教各位高手,如何解决这一问题,谢谢! 自定义函数如下:
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 And icell.Value <> "" Then
countcolor = countcolor + 1
End If
Next icell
End Function