Set the color row by row : Row « Excel « VBA / Excel / Access / Word






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

 








Related examples in the same category

1.change row height
2.Select active row
3.Clearing a range differs from deleting a range. When you delete a range, Excel shifts the remaining cells around to fill up the range you deleted.
4.Select entire row
5.Select first to last row
6.Get the last row and last cell
7.Delete empty rows
8.Bold cells in a Row
9.Array to rows
10.Array to rows - method (Limited to 65,536)
11.Is in last row
12.returns a number that represents the last nonempty cell in the same row