Excel用户定义的功能:更改单元格的颜色 [英] Excel User Defined Function: change the cell's color

查看:91
本文介绍了Excel用户定义的功能:更改单元格的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel中有一个用户定义的函数。它被称为电子表格单元格的公式函数,并且工作正常。



我希望该函数能够根据返回的值更改单元格的颜色。基本上,更改单元格的颜色是功能的副作用。



我尝试过

 code> Application.ThisCell.Interior.ColorIndex = 2 

但它失败了。 >

解决方案

这不能完成。用户定义的函数不能更改工作簿/工作表等的状态。



使用条件格式化来实现您正在尝试的内容。


$ b $编辑:这更像是一个建议,而不是真正的答案。


I have a user defined function in Excel. It is called as a formula function from spreadsheet cells and works fine.

I'd like the function to be able to change the cell's color depending on the value that it returns. Essentially, changing the cell's color is a side effect of the function.

I tried

Application.ThisCell.Interior.ColorIndex = 2

But it fails.

解决方案

This cannot be done. User defined functions cannot change the state of the workbook/worksheet etc.

Use Conditional Formatting to achieve what you are trying.

EDIT: This is more of a suggestion, not a real answer.

这篇关于Excel用户定义的功能:更改单元格的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆