Hi,
I have a VBA code that let me applying CF rule in a range,
but face a problem that prevent the code from doing his job as well
the CF is based on Function which complex somewhat
I have 3 formulas
1 >> set Yellow color 2 >> set Red color 3 >> set Green color
When release the Code the "Green" color only that apply and to preview the other 2 color should Open "CF Rules Manager" then double click in each Rule to open pop out "Edit Formatting Rule" to click "OK" then at last click "Apply"
Is there solvable in editing the VBA code?
I'm Use office 2013
Code:
I have a VBA code that let me applying CF rule in a range,
but face a problem that prevent the code from doing his job as well
the CF is based on Function which complex somewhat
I have 3 formulas
1 >> set Yellow color 2 >> set Red color 3 >> set Green color
When release the Code the "Green" color only that apply and to preview the other 2 color should Open "CF Rules Manager" then double click in each Rule to open pop out "Edit Formatting Rule" to click "OK" then at last click "Apply"
Is there solvable in editing the VBA code?
I'm Use office 2013
Code:
Code:
Sub CF_01()
'July 11, 2014
With Range("E5:BP300")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(ISNUMBER($DA5),ISNUMBER(MATCH(E$2,IF(HC=""lunch"",INDEX(TD,$DA5,0)),0)))"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior 'FormatConditions(1) This was correct.
.PatternColorIndex = xlAutomatic
.Color = RGB(255, 255, 0) '<< yellow
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = True 'FormatConditions(1)
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(ISNUMBER($DA5),ISNUMBER(MATCH(E$2,IF(HC=""break"",INDEX(TD,$DA5,0)),0)))"
.FormatConditions(.FormatConditions.Count).SetLastPriority
With .FormatConditions(2).Interior 'FormatConditions(2)
.PatternColorIndex = xlAutomatic
.Color = RGB(255, 0, 0) '<< red
.TintAndShade = 0
End With
.FormatConditions(2).StopIfTrue = True 'FormatConditions(2)
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(ISNUMBER($DA5),IF(ISNA(MATCH(E$2,IF(HC=""break"",INDEX(TD,$DA5,0)),0))," _
& "IF(E$2>=INDEX(TD,$DA5,1)," _
& "IF(E$2<IF(INDEX(TD,$DA5,COLUMNS(TD))=0,1,INDEX(TD,$DA5,COLUMNS(TD))),1,0),0),0),0)"
.FormatConditions(.FormatConditions.Count).SetLastPriority
With .FormatConditions(3).Interior 'FormatConditions(3)
.PatternColorIndex = xlAutomatic
.Color = RGB(0, 255, 0) '<< green
.TintAndShade = 0
End With
.FormatConditions(3).StopIfTrue = True 'FormatConditions(3)
End With
End Sub