title: Last row in column VBA
body: <p>I wrote a short VBA code to automate stuff.<br/>
  A short snippet is as follows:</p>
  
  <pre><code>Sub TEST()
  
      Rows("1:2").Select
      Selection.Delete Shift:=xlUp
      Range("A1").Select
      ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$O$148"), , xlYes).Name = _
          "Table2"
  
  End Sub
  </code></pre>
  
  <p>However, every Excel file differs with regards to the number of rows. Now when I recorded this macro it just takes the range of $A$1:$O$148. How can I adjust this part so that it automatically recognizes the last row and/or range?</p>
  
  <p>I already tried:</p>
  
  <pre><code>.Range("A1").SpecialCells(xlCellTypeLastCell).Row
  </code></pre>
  
  <p>Instead of:</p>
  
  <pre><code>Range("$A$1:$O$148")
  </code></pre>
  
  <p>Thanks in advance!</p>