title: VBA: Selecting range by variables
body: <p>I want to select the formatted range of an Excel sheet.
  To define the last and first row I use the following functions:</p>
  
  <pre><code>lastColumn = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.Count
  lastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
  </code></pre>
  
  <p>In the next step I want to select this area:
  Formula should look like this:</p>
  
  <pre><code>Range(cells(1, 1), cells(lastRow, lastColumn).Select
  </code></pre>
  
  <p>However, this is not working. Maybe somebody has an idea what is wrong with it. Thanks a lot!</p>