Color cells
Public Sub ColorCells()
Dim Sales As Range
Dim i As Long
Dim j As Long
Set Sales = Range("SalesData")
For i = 1 To Sales.Rows.Count
For j = 1 To Sales.Columns.Count
If Sales.Cells(i, j).Value < 100 Then
Sales.Cells(i, j).Font.ColorIndex = 3
Else
Sales.Cells(i, j).Font.ColorIndex = 1
End If
Next j
Next i
End Sub
Related examples in the same category