title: Copy a row with multiple criteria in Excel VBA even if some of cells are empty
body: <p>I am trying to copy a row from <code>sheet1</code> to <code>sheet2</code> with multiple criteria.</p>
  <p>My code does not work when some of the cells are empty within the row where other criteria are met.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub TextBox1_Change()
      Sheets(&quot;Sheet2&quot;).Range(Cells(2, 1), Cells(49, 8)).Clear    
      Dim i As Long
      Dim client As String
      Dim bLength As String
      Dim span As String
      Dim height As String
      Dim baySpacing As String
      Dim siteLocation As String
      Dim comments As String
      Dim Lastrow As Long
      Dim Lastrowb As Long
  
      client = TextBox1.Text
      bLength = TextBox2.Value
      span = TextBox3.Value
      height = TextBox4.Value
      baySpacing = TextBox5.Value
      siteLocation = TextBox6.Text
      comments = TextBox7.Text
  
      Lastrow = Sheets(1).Cells(Rows.Count, &quot;A&quot;).End(xlUp).Row
      Lastrowb = Sheets(2).Cells(Rows.Count, &quot;A&quot;).End(xlUp).Row + 1
  
      For i = 3 To Lastrow
          
          If InStr(UCase(Sheets(1).Cells(i, 1).Text), UCase(client)) And _
             InStr(Sheets(1).Cells(i, 2).Value, bLength) And _
             InStr(Sheets(1).Cells(i, 3).Value, span) And _
             InStr(Sheets(1).Cells(i, 4).Value, height) And _
             InStr(Sheets(1).Cells(i, 5).Value, baySpacing) And _
             InStr(UCase(Sheets(1).Cells(i, 6).Text), UCase(siteLocation)) And _
             InStr(UCase(Sheets(1).Cells(i, 7).Text), UCase(comments)) Then
  
              Sheets(1).Rows(i).Copy Destination:=Sheets(2).Rows(Lastrowb)
              Lastrowb = Lastrowb + 1
              
          End If
      Next
  End Sub
  </code></pre>
  <p>I want a copy even if any of the cells are empty when other criteria meet.</p>