Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 1,113
- Office Version
- 365
- Platform
- Windows
Good Day All,
i 'm trying to work on a code, where if a row has data in Columns B:E & G, and any information contained from that rows Column H:Z that when Column F is blank under these conditions that its interior cell color will turn red.
Likewise, if under this conditions Column F is not blank, the code will do nothing but I cannot get the VBA code to work.
Please note, that this proposed criterion ignores Column A's information.
Can someone help me sort out a VBA for this?
Thank you in advance!
Respectfully,
pinaceous
i 'm trying to work on a code, where if a row has data in Columns B:E & G, and any information contained from that rows Column H:Z that when Column F is blank under these conditions that its interior cell color will turn red.
Likewise, if under this conditions Column F is not blank, the code will do nothing but I cannot get the VBA code to work.
VBA Code:
Option Explicit
Sub color()
Dim lr&, cell As Range, rng As Range
Set rng = Range("F1:F" & Cells(Rows.Count, "B").End(xlUp).Row).SpecialCells(xlCellTypeBlanks)
For Each cell In rng
cell.Interior.color = xlNone
With WorksheetFunction
If .Count(cell.Offset(, -4).Resize(1, 4)) = 4 And .Count(cell.Resize(, 21)) > 0 Then
cell.Interior.color = vbRed
End If
End With
Next
End Sub
Please note, that this proposed criterion ignores Column A's information.
Can someone help me sort out a VBA for this?
Thank you in advance!
Respectfully,
pinaceous