I am writing code so that when the value of a cell has a certain value it highlights a range for that row (columns G-O, but not the entire row). The code below is recognizing the values of "c" correctly but coloring random rows. For example, when row 2 (O2) has a value under 40, it colors row 4. Please help!
Sub color()
Dim lastrow As Long
Dim c As Variant
lastrow = Range("o" & Rows.Count).End(xlUp).Row
For Each c In Range("O1:O" & lastrow)
If c.Value < 40 Then
' MsgBox (c)
Range(Cells(c, 7), Cells(c, 15)).Interior.ColorIndex = 7
End If
Next c
End Sub