I've researched a loop from a 2009 question and tried to adapt it to select my cells in columns E & F that are greater than zero and highlight them green (if they are 0 then do nothing). Those columns have formulas that are returning values as appropriate without errors. When I tried to adapt the loop I got a compile error that I don't understand how to fix. The error states that "for each control variable must be variant or object" and it highlights the first "c" in the second row. The loop's adapted instructions are:
'Format GYR in table
i = 6 'start row number
For Each c In ActiveSheet.Range("e6:f" & Range("f" & Rows.Count).End(xlUp).Row)
If Cells(i, 5) > 0 Then
Rng = "e" & i & ":" & "f" & i
Range(Rng).Interior.ColorIndex = 4 'green
'If Cells(i, 4) = "" Then
' Cells(i, 4).Interior.ColorIndex = 3 'red
Else
End If
End If
i = i + 1
Next c
Can anyone help with working out the loop errors so that my cells that are greater than zero in column E & F can get colored green?
'Format GYR in table
i = 6 'start row number
For Each c In ActiveSheet.Range("e6:f" & Range("f" & Rows.Count).End(xlUp).Row)
If Cells(i, 5) > 0 Then
Rng = "e" & i & ":" & "f" & i
Range(Rng).Interior.ColorIndex = 4 'green
'If Cells(i, 4) = "" Then
' Cells(i, 4).Interior.ColorIndex = 3 'red
Else
End If
End If
i = i + 1
Next c
Can anyone help with working out the loop errors so that my cells that are greater than zero in column E & F can get colored green?