title: Color entire row when condition is met
body: <p><a href="https://i.stack.imgur.com/HvTPN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HvTPN.png" alt="Green file"></a></p>
  
  <p>What the code is doing is if Col X and Y contains dates, color entire row as yellow.<br>
  If only X contains a date, color entire row as red.<br>
  But if X and Y are empty, color it green. On the last condition.</p>
  
  <p>I can't make my code work to color entire row if condition is met.</p>
  
  <pre><code>Dim i As Long
  Dim lrX As Long     'last row with a filled cell in column X
  Dim lrY As Long     'last row with a filled cell in column Y
  Dim lr As Long      'max of lrX and lrY
  Dim ws As Worksheet
  
  Set ws = ActiveSheet
  
  lrX = Range("X" &amp; Rows.Count).End(xlUp).Row
  lrY = Range("Y" &amp; Rows.Count).End(xlUp).Row
  lr = Application.WorksheetFunction.Max(lrX, lrY)
  
  For i = 2 To lr     'my data starts in row 1, otherwise change this
      If IsDate(ws.Range("X" &amp; i).Value) Then
          If IsDate(ws.Range("Y" &amp; i).Value) Then
            ws.Range("a" &amp; i).EntireRow.Interior.Color = vbYellow       'both X and Y have a date value, so Yellow
          Else
            ws.Range("a" &amp; i).EntireRow.Interior.Color = vbRed        'only X has a date
          If (.Cells(i, 24).Value = "") And _
          (.Cells(i, 25).Value = "") Then
           .Rows(i).EntireRow.Interior.ColorIndex = 4  ' 4: Green
          End If
      End If
  
  Next i
  </code></pre>