title: vba excel how to check if cell not empty and color the entire row?
body: <p>i have VBA code that compare dates of the user input with the current dates and fill the background by the appropriate color. all it works fine.</p>
  
  <p>now i need to make the system to check if the  cell in column <strong>F</strong>  of the selected row <strong>is not empty</strong> i need to colored the column <strong>D,E,F</strong> in  gray color.</p>
  
  <h1>code:</h1>
  
  <pre><code>Private Sub CommandButton1_Click()
  
      Dim i As Integer
  
      For i = Range("C5000").End(xlUp).Row To 2 Step -1 'Range upto 5000, chnge this as per your requirment'
  
          If IsEmpty(Cells(i, 3)) Then
              Cells(i, 3).Interior.Color = xlNone
  
          ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) &lt; 0 Then
              Cells(i, 3).Interior.Color = vbGreen
  
          ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) = 0 Then
              Cells(i, 3).Interior.Color = vbYellow
  
          ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) &gt;= 1 And (VBA.CDate(Cells(i, 3)) - VBA.Date()) &lt;= 4 Then
              Cells(i, 3).Interior.Color = vbRed
  
          ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) &gt;= 5 And (VBA.CDate(Cells(i, 3)) - VBA.Date()) &lt;= 10 Then
              Cells(i, 3).Interior.Color = vbCyan
  
          Else
              Cells(i, 3).Interior.ColorIndex = xlNone
  
          End If
  
      Next
  
  End Sub
  </code></pre>
  
  <p>i will appreciate any help </p>