title: Stop for loop before empty cell
body: <pre><code>for ($i = 1; $i -le $somenumberofusedcellsinthecolumn; $i++) {
       $cell = $ws.Cells.Item($i, 1)
       $value = $cell.Value2 -as [string]
       write-host $value  
  }
  </code></pre>
  
  <p>I want my for loop to terminate when the next cell in the column is empty. I don't know though how to get set the ending point for my loop though since people could add more data to the excel sheet.</p>
  
  <p>I've seen online that some people have used the following as their ending point for the loop, but I'm not sure how to implement it.</p>
  
  <pre><code>   $rows = $ws.range("c2").currentregion.rows.count
  </code></pre>