I can't seem to get this conditional formatting code to work.
Error:Run-time error '5'
Invalid procedure call or argument
xlCellValue works:
xlExpression fails:
I want to fill any [TechComp] column cells with Red if it is blank (has no date) & [CloseDate] is not blank (has a date).
Any help appreciated, thanks
Using this as a formula in a cell returns TRUE or FALSE correctly
Error:Run-time error '5'
Invalid procedure call or argument
xlCellValue works:
Code:
With .Range("tblGlobalData[Response Time]").FormatConditions _
.Add(xlCellValue, xlEqual, "FAIL")
.Font.ColorIndex = 3 ' red
.StopIfTrue = True
End With
xlExpression fails:
Code:
Range("tblGlobalData[TechComp]").Select
' FAILS HERE
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=AND( ISNUMBER(tblGlobalData[[#This Row],[CloseDate]]), ISBLANK(tblGlobalData[[#This Row],[TechComp]]) )"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).Interior.Color = 255
Selection.FormatConditions(1).StopIfTrue = True
I want to fill any [TechComp] column cells with Red if it is blank (has no date) & [CloseDate] is not blank (has a date).
Any help appreciated, thanks
Using this as a formula in a cell returns TRUE or FALSE correctly
Code:
=AND( ISNUMBER( tblGlobalData[[#This Row],[CloseDate]]), ISBLANK(tblGlobalData[[#This Row],[TechComp]] ) )
Last edited: