title: Select Table using VBA
body: <p>I want to select the whole table using VBA. Without using VBA, I could use Ctrl+A function and select the whole table. I tried a different method but still to no avail.</p>
  <p>1st method:</p>
  <pre><code>Dim last_row As Long
  Dim last_column As Long
  
  Sheets(&quot;sheet1&quot;).Select
  last_row = Cells(Rows.Count, 1).End(xlUp).Row
  
  
  last_column = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
  
  Range(&quot;A1:last_row &amp; last_column&quot;).Select
  'ActiveCell.Offset(last_row, last_column).Range(&quot;A1&quot;).Select
  </code></pre>
  <p>2nd method:</p>
  <pre><code>Sheets(&quot;Sheet1&quot;).Select
  
  Dim CSLastRow As Long
  Dim CSLastColIndex As Long
  Dim Last As Long
  
  'finding last row
  CSLastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, &quot;A&quot;).End(xlUp).Row
  'finding last col
  CSLastColIndex = Cells.Find(What:=&quot;I will recommend this course to others.&quot;, _
                  after:=Range(&quot;A1&quot;), _
                  LookAt:=xlPart, _
                  LookIn:=xlFormulas, _
                  SearchOrder:=xlByRows, _
                  SearchDirection:=xlPrevious, _
                  MatchCase:=False).Column
  ColumnLetter = Split(Cells(1, CSLastColIndex).Address, &quot;$&quot;)(1)
  
  Last = concatenate(ColumnLetter, CSLastRow)
  
  Range(&quot;A1:&quot; &amp; Last).Select
  </code></pre>