使用FormatConditions获取单元格的背景颜色 [英] Get the background color of a cell with FormatConditions

查看:394
本文介绍了使用FormatConditions获取单元格的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello

我需要知道根据条件格式更改的单元格的背景颜色。所以".interior.color"对我不起作用。

I need to know the background color of a cell that is changed according conditional formatting. So ".interior.color" doesn't work for me.

这不是"单元格的价值"。有一个操作员(不确定翻译,因为我有法国Excel)条件格式,但"公式是"。

This is not a "The value of the cell is" with an operator (not sure of the translation as far as I have a french Excel) conditional format, but a "The formula is".

单元格包含一个日期(DD / MM) / YYYY - 法国订单)和格式条件

The cell contains a Date (DD/MM/YYYY - french order) and the format condition

is =IF(AND(DATE(YEAR(TODAY());MONTH(TODAY())-12;DAY(TODAY()))>=N23;N23<>"");TRUE;FALSE)

寻找答案,我试图用变量tp评估条件:

Looking for answers around, I tried to evaluate the condition with a variant tp:

tp = Evaluate(Worksheets("F1").Range("M7").FormatConditions(1).Formula1)

但是它会导致2015年的错误。

but it results in a error 2015 in tp.

有人能告诉我如何在tp中获取bool值以了解条件是真还是假?

Could anyone tell me how to get a bool value in tp to know if the condition is true or false?

谢谢

Cathy L。

 

推荐答案

尝试使用/不选择单元格(代码行4)。

Try this with/without selecting the cell (code line 4).

Sub TestingCF()

Dim tp As Boolean

D. im strFormula As String

ActiveSheet.Range(" M7")。选择

strFormula = ActiveSheet.Range(" M7")。FormatConditions(1).Formula1

tp = ActiveSheet.Evaluate(strFormula)

MsgBox tp& vbCr& strFormula

End Sub

'---

Jim Cone

美国俄勒冈州波特兰市
http://www.mediafire.com/PrimitiveSoftware


(支票加载项"Free folder"中的"确定颜色")

Sub TestingCF()
Dim tp As Boolean
Dim strFormula As String
ActiveSheet.Range("M7").Select
strFormula = ActiveSheet.Range("M7").FormatConditions(1).Formula1
tp = ActiveSheet.Evaluate(strFormula)
MsgBox tp & vbCr & strFormula
End Sub
'---
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(check out the add-in "Determine Colors" in the Free folder)


这篇关于使用FormatConditions获取单元格的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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