[英]excel 2013 interior.color “#Value!” error
When i try to change color of a cell using a function like this: 当我尝试使用以下功能更改单元格的颜色时:
Function abcd()
Worksheets("Sheet1").Cells(1, 1).Interior.ColorIndex = 3
End Function
by calling the function from a cell "=abcd()" it returns a "#Value!" 通过从单元格“ = abcd()”调用该函数,它将返回“ #Value!”。 error.
错误。
but if i use a sub and run it manually (by pressing the run button) it will work fine. 但是,如果我使用一个子并手动运行它(通过按运行按钮),它将正常工作。
Sub abcd()
Worksheets("Sheet1").Cells(1, 1).Interior.ColorIndex = 3
End Sub
but i want call the function from a cell and i dont want to use conditional formatting. 但是我想从一个单元格中调用该函数,并且我不想使用条件格式。 what am i doing wrong?
我究竟做错了什么?
A function can only return a value to a cell, it cannot change formats. 函数只能将值返回到单元格,不能更改格式。 Use Conditional Formatting
使用条件格式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.