【发布时间】:2016-12-09 14:11:27
【问题描述】:
有没有人遇到过一个真正适用于条件格式的函数?
kutools 和 albebits 有一些插件,但它们不是基于公式的(您必须手动选择所有内容)
我找到了这个,但仅适用于手动格式化
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell) + vResult
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
【问题讨论】: