Im trying to use VBA to fill the entire sheet either red or green based on the cell values in column I. I made the code below but it is giving me an error with my range line.
I want to fill the sheet red if any cell in column I is equal to 1 or greater, and fill it green if any cell is equal to 0.
[pre]
[/pre]
Thanks for your help,
James
I want to fill the sheet red if any cell in column I is equal to 1 or greater, and fill it green if any cell is equal to 0.
[pre]
Code:
Sub Macro1()
Sheets("Menu").Activate
With Menu
For Each Cell In .Range("I:I")
If Cell.Value >= 1 Then
Sheet.Interior.Color = vbRed
ElseIf Cell.Value = 0 Then
Sheet.Interior.Color = vbGreen
Else
Cell.Interior.Color = vbYellow
End If
Next Cell
End With
End Sub
Thanks for your help,
James