Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Set the color row by row

Sub ColorCells3()    Dim myRange As Range    Dim i As Long       Set myRange = Range("A1:E5")    For i = 1 To myRange.Cells.Count       If myRange(i).Value < 100 Then          myRange(i).Font.ColorIndex = 6       Else         myRange(i).Font.ColorIndex = 1       End If    Next i End Sub