Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Changes color of numbers 100

Sub ColorCells1()    Dim myRange As Range    Dim i As Long, j As Long      Set myRange = Range("A1:A5")    For i = 1 To myRange.Rows.Count       For j = 1 To myRange.Columns.Count          If myRange.Cells(i, j).Value < 100 Then             myRange.Cells(i, j).Font.ColorIndex = 3          Else             myRange.Cells(i, j).Font.ColorIndex = 1          End If       Next j    Next i End Sub