fluffynicesheep
Board Regular
- Joined
- Oct 27, 2009
- Messages
- 69
Hi,
I currently have some vba code that looks at column BM and if the cell is empty then it sets the interior colour to white for all cells in the row (from BM to BZ). If there is something in the cell in column BM then it changes everything in the above range to yellow.
What I want to add to this (but have no idea how) is - if the cell in column BM is not empty, but one of the cells (in the same row) from BN to BZ is empty, then it turns that particular cell to red (with rest staying yellow)
Here's what I have at the moment:
Any help would be greatly received!!
I currently have some vba code that looks at column BM and if the cell is empty then it sets the interior colour to white for all cells in the row (from BM to BZ). If there is something in the cell in column BM then it changes everything in the above range to yellow.
What I want to add to this (but have no idea how) is - if the cell in column BM is not empty, but one of the cells (in the same row) from BN to BZ is empty, then it turns that particular cell to red (with rest staying yellow)
Here's what I have at the moment:
VBA Code:
Sub Colour()
Dim i As Long, r1 As Range, r2 As Range
Dim LastRow As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
Set r1 = Range("BM" & i)
Set r2 = Range("BM" & i & ":BZ" & i)
If r1.Value = "" Then r2.Interior.Color = vbWhite
If r1.Value <> "" Then r2.Interior.Color = vbYellow
Next i
End Sub
Any help would be greatly received!!