3
有没有人跑过一个实际上可以使用条件格式的函数?自定义excel公式函数UDF来计算条件格式
有一些插件的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
有趣。我从来没有想过使用Evaluate作为包装函数。 – Comintern
@Comintern - related:https://stackoverflow.com/questions/23433096/using-a-udf-in-excel-to-update-the-worksheet/23437280#23437280 –