title: excel vba select last row and last column
body: <p>I am trying to select from <code>A9</code> to the <code>lastrow &amp; lastcolumn</code>.</p>
  
  <p>I have this to select the last cell, but it doesn't select from <code>A9 to Last</code> it just selects the lastrow/lastcolumn. Also this is not ideal because if I have blanks in the future.</p>
  
  <p>I have searched and could not find anything for selecting from a cell to the <code>lastrow &amp; lastcolumn</code></p>
  
  <pre><code>Sub FindLast()
  Application.ScreenUpdating = False
  
  Range("A9").End(xlToRight).End(xlDown).Select
  
  Application.ScreenUpdating = True
  End Sub
  </code></pre>
  
  <p>Search order in my file would be Column <code>A</code> &amp; Row <code>8</code> if that helps at all.</p>
  
  <blockquote>
    <p>Code Below is what I am using to work on active sheets</p>
  </blockquote>
  
  <pre><code>Sub SelectAll()
  Application.ScreenUpdating = False
  
  Dim lastRow As Long, lastCol As Long
  Dim Rng As Range
  Dim WholeRng As Range
  
  With ActiveWorksheet
      Set Rng = Cells
  
      'last row
      lastRow = Rng.Find(What:="*", After:=Rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row
  
      'last column
      lastCol = Rng.Find(What:="*", After:=Rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False).Column
  
      Set WholeRng = Range(Cells(9, "A"), Cells(lastRow, lastCol))
      WholeRng.Select
  End With
  
  Application.ScreenUpdating = True
  End Sub
  </code></pre>