I've searched for examples and tried many different things, but it's just not working. This is a personal project I'm working on and would love some help to get it solved and running.
I've made a list and I want to go through a column (with an UNKNOWN set Range, items may be added or removed), and if the cell value says "Yes" I want it colored Green. If it says "No" I want it colored Red.
Here is what I have so far...
Dim cell As Range
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Range("C2").End(xlDown).Offset(2, 0).Value = "Yes" Then
cell.Interior.Color = RGB(0, 255, 0)
cell.Interior.Color = RGB(255, 0, 0)
I'm a little confused comparing your story with your code.
Try this code and see if it yields the desired result:
lRow = Range("C" & Rows.Count).End(xlUp).Row
Set MR = Range("C2:C" & lRow)
For Each cell In MR
If cell.Value = "Yes" Then cell.Interior.ColorIndex = 10
If cell.Value = "No" Then cell.Interior.ColorIndex = 3
Was this answer helpful?Thanks for your feedback.
Don't forget to take a few seconds to say thanks: Thanks for your feedback.
We're sorry. Our aim is to give you the best possible answer.