我正在尝试显示excel中条件格式的颜色.在excel中我只使用= CheckColour(B5),当我点击返回时它可以工作.但是,当我要求工作表计算时,函数给出#VALUE!而且我不知道我哪里出错了.任何帮助都表示赞赏,因为我是VBA的初学者.谢谢
Function CheckColour(range)
If range.DisplayFormat.Interior.Color = RGB(255, 0, 0) Then
CheckColour = "Red"
ElseIf range.DisplayFormat.Interior.Color = RGB(0, 130, 59) Then
CheckColour = "Green"
Else
CheckColour = "Amber"
End If
End Function
Run Code Online (Sandbox Code Playgroud)