[英]Conditional formatting based on the result of IF formula in the cell
Is there a way we can do conditional formatting based on the result of IF condition present in cell no matter what it returns? 有没有一种方法可以根据单元格中存在的IF条件的结果进行条件格式化,无论它返回什么?
Like if it returns true
then color it green if false
color it red 就像如果返回
true
则将其上色为绿色,如果为false
则将其上色为红色
The formula looks like this on sheet2 =IF(Sheet3!C35="", Sheet3!B35, Sheet3!C35)
it can return any value which is in B or column C that's what makes it hard for me to conditionally format it using hardcoded values or ranges because they are not well defined 该公式在sheet2
=IF(Sheet3!C35="", Sheet3!B35, Sheet3!C35)
上看起来像这样,它可以返回B或C列中的任何值,这使我很难使用硬编码有条件地对其进行格式设置值或范围,因为它们的定义不明确
I thought of doing it via a macro like this 我想通过这样的宏来做
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Application.EnableEvents = False
If Target.Cells.Count = 1 And Target.Cells.HasFormula Then
'Logic to check the if condition
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.