条件格式错误 VBA
Conditional Formatting Error VBA
我想知道是否有人可以提供帮助?!我在以下行收到错误:
.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""Awaiting Information"")) = 1"
下面是代码。
Sub ConditionalFormat()
Sheets("NACO").Cells.FormatConditions.Delete
With Worksheets("NACO").Columns("A:N").FormatConditions
**.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""Awaiting Information"")) = 1"**
With .Item(.Count).Interior
.Color = 255
End With
.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""On Going"")) = 2"
With .Item(.Count).Interior
.Color = 225
End With
.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""Awaiting Quotation"")) = 3"
With .Item(.Count).Interior
.Color = 255
End With
.Add Type:=xlExpression, Formula1:= _
"=$F1=""On Going"" = 4"
With .Item(.Count).Interior
.Color = RGB(247, 150, 70)
End With
End With
End Sub
有人可以解释为什么会出现错误吗?跟“”有关系吗?
你能试试把公式改成这个吗:
=IF(AND($E1<>"",$E1<TODAY(),$F1="Awaiting Information")=1
?
我想知道是否有人可以提供帮助?!我在以下行收到错误:
.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""Awaiting Information"")) = 1"
下面是代码。
Sub ConditionalFormat()
Sheets("NACO").Cells.FormatConditions.Delete
With Worksheets("NACO").Columns("A:N").FormatConditions
**.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""Awaiting Information"")) = 1"**
With .Item(.Count).Interior
.Color = 255
End With
.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""On Going"")) = 2"
With .Item(.Count).Interior
.Color = 225
End With
.Add Type:=xlExpression, Formula1:= _
"=IF($E1<>"",AND($E1<TODAY(),$F1=""Awaiting Quotation"")) = 3"
With .Item(.Count).Interior
.Color = 255
End With
.Add Type:=xlExpression, Formula1:= _
"=$F1=""On Going"" = 4"
With .Item(.Count).Interior
.Color = RGB(247, 150, 70)
End With
End With
End Sub
有人可以解释为什么会出现错误吗?跟“”有关系吗?
你能试试把公式改成这个吗:
=IF(AND($E1<>"",$E1<TODAY(),$F1="Awaiting Information")=1
?