EXCEL颜色求和2009-08-27 16:08
Function COLORSUM(xx As Range, yy As Range) As Double
y = yy.Font.ColorIndex
For Each x In xx
If x.Font.ColorIndex = y Then
xxx = xxx + x.Value
End If
Next
COLORSUM = xxx
End Function
假设数字是在A1:A100
而A2的数字颜色是作为自动求和的识别
只要将上述VBA贴在模块上, COLORSUM函数便可以使用
输入公式 =COLORSUM(A1:A100,A2)
便会所有与A2相同颜色的数字, 自动求和
联系客服