title: If IsEmpty then go to column A but in same row and extract that data
body: <p>I am creating a spreadsheet which has many columns and I am trying to make it check if a cell in a certain column is empty then it will check to see the cells in the other columns of the same row are empty. Currently the only way I know of is if you say exactly what cell you are checking.</p>
  
  <pre><code>'Checking If the "Email Sent Columb cells are empty so it can be set to "No"
  If IsEmpty(ThisWorkbook.Sheets(2).Range("F2")) Then
  ThisWorkbook.Sheets(2).Range("F2") = "No"
    If IsEmpty(ThisWorkbook.Sheets(2).Range("J2")) Then
    ThisWorkbook.Sheets(2).Range("J2") = "No"
      If IsEmpty(ThisWorkbook.Sheets(2).Range("M2")) Then
      ThisWorkbook.Sheets(2).Range("M2") = "No"
      End If
  End If
  End If
  
  'If Acknowledge Email Sent = No then it will check if there are any fields that are       empty if not then it will send the email and mark
  'it as sent
  If ThisWorkbook.Sheets(2).Range("F2") = "No" Then
  
  If IsEmpty(ThisWorkbook.Sheets(2).Range("A2")) Then
  MsgBox "A2 Empty"
  Else
  If IsEmpty(ThisWorkbook.Sheets(2).Range("B2")) Then
  MsgBox "B2 Empty"
  Else
      If IsEmpty(ThisWorkbook.Sheets(2).Range("C2")) Then
      MsgBox "C2 Empty"
      Else
          If IsEmpty(ThisWorkbook.Sheets(2).Range("D2")) Then
          MsgBox "D2 Empty"
          Else
              If IsEmpty(ThisWorkbook.Sheets(2).Range("E2")) Then
              MsgBox "E2 Empty"
              Else
              MsgBox "Acknowledge Email Ready To Be Sent"
              ThisWorkbook.Sheets(2).Range("F2") = "Yes"
              End If
          End If
      End If
  End If
  End If
  
  End If
  
  'If Update Email Sent = No then it will check if further evidence is required if it is     then it will check if the evidence required is
  'not empty, if it isnt empty then it will send the email and mark it as sent, but if further evidence required is set to no then it
  'will mark it as unnecessary.
  If ThisWorkbook.Sheets(2).Range("J2") = "No" Then
  
  If ThisWorkbook.Sheets(2).Range("H2") = "Yes" Or ThisWorkbook.Sheets(2).Range("H2") =  "" Then
  
  If IsEmpty(ThisWorkbook.Sheets(2).Range("H2")) Then
  MsgBox "H2 Is Empty"
  Else
  If IsEmpty(ThisWorkbook.Sheets(2).Range("I2")) Then
  MsgBox "I2 Is Empty"
  Else
      MsgBox "Update Email Ready To Be Sent"
      ThisWorkbook.Sheets(2).Range("J2") = "Yes"
  End If
  End If
  Else
  ThisWorkbook.Sheets(2).Range("J2") = "Unnecessary"
  
  End If
  
  End If
  
  If ThisWorkbook.Sheets(2).Range("M2") = "No" Then
  
  If ThisWorkbook.Sheets(2).Range("L2") = "" Then
  MsgBox "L2 Is Empty"
  Else
  If ThisWorkbook.Sheets(2).Range("L2") = "Approved with Pay" Then
  MsgBox "Approved with Pay Email Sent"
  ThisWorkbook.Sheets(2).Range("M2") = "Yes"
  Else
  If ThisWorkbook.Sheets(2).Range("L2") = "Approved without Pay" Then
  MsgBox "Approved without Pay Email Sent"
  ThisWorkbook.Sheets(2).Range("M2") = "Yes"
  Else
  If ThisWorkbook.Sheets(2).Range("L2") = "Approved in Part" Then
  MsgBox "Approved in Part Email Sent"
  ThisWorkbook.Sheets(2).Range("M2") = "Yes"
  Else
  If ThisWorkbook.Sheets(2).Range("L2") = "Referred back to the Line Manager" Then
  MsgBox "Approved without Pay Email Sent"
  ThisWorkbook.Sheets(2).Range("M2") = "Yes"
  End If
  End If
  End If
  End If
  End If
  End If
  </code></pre>
  
  <p>This is how I have edited the below code, but it doesn't seem to be working</p>
  
  <pre><code>Option Explicit
  Sub Test3()
  End Sub
  
  Public Function CheckIfRowIsEmpty(ByVal P2 As Range, _
                                    ByVal colsToCheck As Integer) As Boolean
  
      Dim isRowEmpty As Boolean
      Dim startRow As Integer
      Dim endRow As Integer
      Dim a As Integer
  
      isRowEmpty = True
  
      If IsCellEmpty(wb.Sheets(2).Range("P2")) = True Then
          startRow = P2.Column
          endRow = P2.Column + (13 - 1)
  
          For a = startRow To endRow
              If IsCellEmpty(P2.Offset(, a)) = False Then
                  isRowEmpty = False
                  Exit For
              End If
          Next a
      Else
          isRowEmpty = False
      End If
      Debug.Print CStr(isRowEmpty)
      CheckIfRowIsEmpty = CStr(isRowEmpty)
  
  End Function
  
  
  Private Function IsCellEmpty(ByVal P2 As Range) As Boolean
      If Len(P2.Value &amp; "") &lt; 1 Then
          IsCellEmpty = True
      Else
          IsCellEmpty = False
      End If
  End Function
  </code></pre>