Change color for cells in a row that are the same as the cell in a row above

Closed
Sarel - Mar 8, 2019 at 11:32 PM
 Blocked Profile - Mar 12, 2019 at 04:49 PM
Hello,
how do I ensure that the VB code changes the colour of cells that are right above it?
Sub ChangeColor()
lRow = Range("C3:I3").End(xlUp).Row
Set MR = Range("C2,D3,F3,G3,H3,I3")
For Each cell In MR
If cell.Value = " Yes" Then cell.Interior.ColorIndex = 10
If cell.Value = "No" Then cell.Interior.ColorIndex = 3
Next
End Sub
Related:

1 response

Blocked Profile
Mar 12, 2019 at 04:49 PM
If you are wanting to change the cell above it, you must keep track of the row, and subtract one from it!
0