Hello,
I try to use conditional formation to apply traffic light icon, based on cell value.
value => 70 and value<=100 green light
value => 40 and value<70 yellow light
value => 0 and value<40 red light
my current code is like:
The following code is not valid.
Any idea how to write the valid code?
I try to use conditional formation to apply traffic light icon, based on cell value.
value => 70 and value<=100 green light
value => 40 and value<70 yellow light
value => 0 and value<40 red light
my current code is like:
PHP:
Sub col()
ThisWorkbook.Sheets("score").Activate
For l = 2 To Application.WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(1, Columns.Count)), "*")
For r = 2 To Application.WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(Rows.Count, 1)), "*")
If Cells(r, l).Value < 40 And Cells(r, l).Value >= 0 Then
With Cells(r, l)
.IconCriteria = IconSets(xl3TrafficLights1)
.Font.Color = vbBlack
.Font.Bold = True
End With
End If
If Cells(r, l).Value >= 40 And Cells(r, l).Value < 70 Then
With Cells(r, l)
.IconCriteria = IconSets(xl3TrafficLights1)
.Font.Color = vbBlack
.Font.Bold = True
End With
End If
If Cells(r, l).Value >= 70 And Cells(r, l).Value <= 100 Then
With Cells(r, l)
.IconCriteria = IconSets(xl3TrafficLights1)
.Font.Color = vbBlack
.Font.Bold = True
End With
End If
Next r
Next l
End Sub
The following code is not valid.
PHP:
.IconCriteria = IconSets(xl3TrafficLights1)