title: How to find the first empty cell in VBA?
body: <p>My sheet look like : <br />
  <a href="https://i.stack.imgur.com/p1RbX.png" rel="nofollow"><img src="https://i.stack.imgur.com/p1RbX.png" alt="enter image description here"></a></p>
  
  <p>I have a function to get index of the <strong>LAST</strong> empty cell in column A:</p>
  
  <pre><code>NextRow = Range("A" &amp; Rows.Count).End(xlUp).Row + 1
  </code></pre>
  
  <p>This function works to write on second array (Type2).</p>
  
  <p>But now, i would like a function to get index of the <strong>FIRST</strong> empty cell in column A. So i went to this website: <a href="http://www.excelhowto.com/macros/find-select-first-blank-cell-column-vba/" rel="nofollow">Select first empty cell</a> and i tried to adapt code but it's doesn't work:</p>
  
  <pre><code>If Array= "Type1" Then
      Dim ws As Worksheet
      Set ws = ActiveSheet
      For Each cell In ws.Columns(1).Cells
         If IsEmpty(cell) = True Then NextRow = cell: Exit For 'ERROR 1004
      Next cell
  End If
  If Array= "Type2" Then 'It s works
      NextRow = Range("A" &amp; Rows.Count).End(xlUp).Row + 1
  End If
  
  ActiveSheet.Range("A" &amp; NextRow) = "TEST"
  </code></pre>
  
  <p>Could you help me to adapt my code to have <code>NextRow = IndexOf FIRST empty cell in A</code> ?</p>