title: VBA Integer Overflow at 70,000
body: <p>I have a worksheet with 70,000 rows of data and a simple macro that counts the total number of rows:</p>
  
  <pre><code>Dim LastRow as Integer    
  LastRow = SourceSheet.Cells.Find(what:="*", searchdirection:=xlPrevious, searchorder:=xlByRows).Row
  MsgBox (LastRow)
  </code></pre>
  
  <p>This returns an overflow error. Changing LastRow to Long returns the correct value of 70,000.</p>
  
  <p>According to <a href="https://msdn.microsoft.com/en-us/library/06bkb8w2.aspx">Microsoft's website</a>, a VBA integer should be able to hold values between -2,147,483,648 and 2,147,483,647. My output is well within this range, so why would it fail?</p>
  
  <p>Thanks!</p>