excel表统计有颜色文本框个数
用下面的自定义函数:
Public Function tcs(rag As Range, ColorrRag As Range)
'填充某一颜色的数字单元格个数,tcs——填充色
For Each cel In rag
If cel.Value <> "" And IsNumeric(cel.Value) And _
cel.Interior.ColorIndex = _
ColorrRag.Interior.ColorIndex Then n = n + 1
Next cel
tcs = n
End Function
================================
Public Function zts(rag As Range, ColorrRag As Range)
'字体是某一颜色的数字单元格个数,zts——字体色
For Each cel In rag
If cel.Value <> "" And IsNumeric(cel.Value) And _
cel.Font.ColorIndex = _
ColorrRag.Font.ColorIndex Then n = n + 1
Next cel
zts = n
End Function
热门标签: