Hello
i have a code that highlight cell (B,C,D,E.F ) in green
my question is how can expand the code to highlight also the cell G
Thanks
i have a code that highlight cell (B,C,D,E.F ) in green
VBA Code:
Sub MyFormat()
Dim rng As Range
Set rng = Range("B5:F700")
With rng
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(COUNTIF($B5:$F5,54)>0,COUNTIF($B5:$F5,9)>0)"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = RGB(0, 128, 0)
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(COUNTIF($B5:$F5,3)>0,COUNTIF($B5:$F5,9)>0)"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = RGB(0, 128, 0)
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(COUNTIF($B5:$F5,5)>0,COUNTIF($B5:$F5,6)>0)"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = RGB(0, 128, 0)
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(COUNTIF($B5:$G5,8)>0,COUNTIF($B5:$G5,10)>0)"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = RGB(0, 128, 0)
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
End With
End Sub
my question is how can expand the code to highlight also the cell G
Thanks