title: Determine the last visible row in Microsoft Excel using VBA
body: <p>I have an Excel sheet with a fixed number of visible rows. I want to write a macro to insert a row after the last visible row.</p>
  
  <p>To do so I first want to determine what the current last visible row is. I tried to write the following but I get a compilation error. I don't know VB very well so I'm properly doing something wrong in the While loop.</p>
  
  <p>Thanks.</p>
  
  <pre><code>Sub AddRequirementRule()
  Dim rowNumber As Long
  rowNumber = 1
  While (Not ActiveSheet.Row(rowNumber).Hidden)
     rowNumber = rowNumber + 1
  End While
  
  
  MsgBox (rowNumber)
  </code></pre>
  
  <p>On a side note, where can I find more information about the error in Excel's Macro editor (VBA 7.0)?</p>