title: Excel VBA: How to exit loop if blank cell found
body: <p>I'm having trouble finding the solution to run the loop if a blank cell is found. This is the first time I've ever used VBA (but hopefully not the last), so thank you in advance for your help and advice.</p>
  
  <p>Basically, for a column of values ("Units"), I want to copy and paste each value into an input box, copy the results and paste elsewhere, then repeat for next value until the next cell in the "Units" column is blank.</p>
  
  <p>Any advice on how to put in this condition would be greatly appreciated. I've tried a variety of "Do while..." and "If..." etc. but couldn't crack the structure.</p>
  
  <hr>
  
  <pre><code>Sub ResultsTable()
  
      Application.ScreenUpdating = False
  
      Dim UnitRows As Integer
      UnitRows = Range("Units").Rows.Count
  
      Do While Range("Units").Cells(i, 1).Value &lt;&gt; ""
  
      i = i + 1
  
          Range("Units").Cells(i, 1).Copy
          Range("Input").PasteSpecial xlPasteValues
  
          Range("ABBA").Copy
          Range("ABBAO").Cells(i, 1).PasteSpecial xlPasteValues
  
          Range("BABBA").Copy
          Range("BABBAO").Cells(i, 1).PasteSpecial xlPasteValues
  
          Range("CABBA").Copy
          Range("CABBAO").Cells(i, 1).PasteSpecial xlPasteValues
  
          Range("DABBA").Copy
          Range("DABBAO").Cells(i, 1).PasteSpecial xlPasteValues
  
  
  
      Range("Units").Copy
      Range("UnitsOutput").PasteSpecial xlPasteValues
  
      Application.ScreenUpdating = True
  
  End Sub
  </code></pre>