title: Finding last row when data skips a blank and not include data after blank
body: <p>I have a VBA code that finds the last row of data in a column and selects all the data. My data has a break a third of the way down where an empty row is placed. I want to be able to find the last row of data before the break and not include the data that is in the same column after the break. Is there a way to do this?</p>
  
  <p>Thanks!</p>
  
  <pre><code>Sub Resort()
  Dim ws As Worksheet
  Set ws = Worksheets("Workbench Report")
  
  lastrow = ws.Cells(ws.Rows.count, "E").End(xlUp).Row
  
  ws.Select
  ws.Range("B2:B" &amp; lastrow).Select
  
  ws.Columns("B:G").Sort key1:=ws.Range("E1"), order1:=xlAscending, Header:=xlYes, Orientation:=xlSortColumns
  
  ws.Select
  ws.Range("E2").Select
  
  End Sub
  </code></pre>