title: Worksheet.UsedRange.Rows.Count returns wrong result
body: <p>In VB.NET I want to get the used rows so I wrote that:</p>
  <pre><code>Dim objWorksheet As Excel.Worksheet = workbook.Sheets(2)
  Dim lastRow = objWorksheet.UsedRange.Rows.Count
  </code></pre>
  <p>The number of lastRow is <strong>less</strong> than used rows. I searched the site and someone suggested:</p>
  <pre><code>Dim range As Excel.Range = objWorkSheet.UsedRange
  Dim lastRow = range.Rows.Count
  </code></pre>
  <p>This returns less than actual used rows.</p>
  <p>The solution is in the image:<br />
  <img src="https://i.stack.imgur.com/Jym1O.png" alt="img1" /></p>
  <p>I found <strong><a href="https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-vba">this question</a></strong> it is an overall understanding of the last used row.</p>
  <p><code>UsedRange.Rows.Count</code> means from the first rows that has data to the last rows that has data, which means you can have empty rows between the first non-empty rows to the last non-empty rows which not affect the result, but if the first row is empty, the result will be one less the actual non-empty row, and if the first two row is empty the result will be two less, so the link question said never use <code>UsedRange.Rows.Count</code> to get the last row.</p>