brunell316
New Member
- Joined
- Dec 10, 2014
- Messages
- 10
Hello All,
I am setting up a macro to edit a workbook that uses conditional formatting when it is edited. Here is the code I have set up to set the conditional formatting for said cell:
With Range("P54")
With .FormatConditions
.Delete
.Add Type:=xlCellValue, Operator:=xlLessEqual, Formula1:="SUM(S54,U54,W54,Y54,AA54)"
.Add Type:=xlExpression, Formula1:="AND(S54="",U54="",W54="",Y54="",AA54="")"
End With
.FormatConditions(1).StopIfTrue = False
.FormatConditions(2).StopIfTrue = False
.FormatConditions(2).Interior.ColorIndex = 0
.FormatConditions(1).Interior.Color = 5287936
.FormatConditions(2).SetFirstPriority
End With
The expression/formula Conditional formatting kicks out the expression I have written exactly here with the quotation marks at the end which then makes the formatting expression not work. I have no clue how to get rid of them in the formula so in the conditional formatting screen it reads:
=AND(S54="",U54="",W54="",Y54="",AA54="")
rather than
="AND(S54="",U54="",W54="",Y54="",AA54="")"
I can't seem to figure it out maybe. Thanks for the help.
I am setting up a macro to edit a workbook that uses conditional formatting when it is edited. Here is the code I have set up to set the conditional formatting for said cell:
With Range("P54")
With .FormatConditions
.Delete
.Add Type:=xlCellValue, Operator:=xlLessEqual, Formula1:="SUM(S54,U54,W54,Y54,AA54)"
.Add Type:=xlExpression, Formula1:="AND(S54="",U54="",W54="",Y54="",AA54="")"
End With
.FormatConditions(1).StopIfTrue = False
.FormatConditions(2).StopIfTrue = False
.FormatConditions(2).Interior.ColorIndex = 0
.FormatConditions(1).Interior.Color = 5287936
.FormatConditions(2).SetFirstPriority
End With
The expression/formula Conditional formatting kicks out the expression I have written exactly here with the quotation marks at the end which then makes the formatting expression not work. I have no clue how to get rid of them in the formula so in the conditional formatting screen it reads:
=AND(S54="",U54="",W54="",Y54="",AA54="")
rather than
="AND(S54="",U54="",W54="",Y54="",AA54="")"
I can't seem to figure it out maybe. Thanks for the help.