如果单元格突出显示,则Excel用户定义的函数 [英] Excel user defined function if cell is highlighted then
问题描述
我创建了一个用户定义的函数来确定细胞是否突出显示特定的颜色,它在某些情况下有效,但不是我需要的那种;基本上它可以在该单元格永久突出显示该颜色时工作,但我基于条件格式设置,如果由于条件格式化单元格是该颜色,则该功能不起作用。
I have created a user defined function to determine whether cells are highlighted a particular color, and it works in some situations, but not the one I need; Basically it works when that cell is permanently highlighted that color but I am basing it on conditional formatting and the function doesn't work if the cell is that color due to conditional formatting.
Public Function Active(Rng As Range) As Boolean
If Rng.Interior.Color = RGB(217, 151, 149) _
Then Active = True
End Function
任何帮助,为什么会非常感激。
Any help as to why would be much appreciated.
推荐答案
对于简单的条件格式(NONE-Color缩放类型),你可以参考@brettdj和@Chuff的外部参考
http://www.xldynamic.com/source/xld.CFConditions.html#specific
For simple Conditional Formatting (NONE-Color scaling type), you can refer to @brettdj and @Chuff 's external reference http://www.xldynamic.com/source/xld.CFConditions.html#specific
我如何找到fil l使用vba在Excel 2007中有条件格式化单元格的颜色值?
对于颜色缩放条件格式,我尝试过pasteSpecial但它不起作用。
For color scaling Conditional formatting, I have tried pasteSpecial but it's not working.
对我来说唯一可行的解决方案是将范围复制到MS Word中,然后将范围复制回EXCEL。这将删除条件格式。然后你可以得到背景颜色
单元格(X,Y).interior.color
The only workable solution for me is to copy the range into MS Word, and then copy the range back into EXCEL. This will remove the conditional formatting. Then you can get the background color as
Cells(X,Y).interior.color
否则你需要自己实现条件格式的颜色缩放类型。
Or else you need to implement the color scaling type of conditional formatting yourself.
这篇关于如果单元格突出显示,则Excel用户定义的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!