title: Total number of rows
body: <p>How do I determine the total number of used rows in my worksheet?</p>
  
  <pre><code>Dim rows As Integer
  rows = ActiveWorkbook.Sheets(1).Range("A65536").End(xlUp).Offset(1, 0).Rows.Count
  </code></pre>
  
  <hr>
  
  <p>I need to know so I can loop through all my rows:</p>
  
  <pre><code>For row = 1 To rows
      ' Check if row contains pattern.
      match = ReFind(Range(row &amp; ":" &amp; row), "^.*(\[KA\])|(\[KIC\])|(\[KS\])|(\[NA\]).*$")
  
      If match &lt;&gt; "" Then
          Call CopyRow(row)
      End If
  Next row
  </code></pre>