title: Application defined or Object defined Error in vba
body: <p>I am writing following lines of code in the click event of the button which is on <code>Sheet2</code>. But this gives me <code>Object Defined or Application Defined</code> error. If I remove <code>Worksheets("Sheet1")</code> then it will work correctly but it selects <code>Sheet2's</code> range. I want the range from <code>Sheet1</code>.</p>
  
  <p>So please help me with this.</p>
  
  <pre><code>Worksheets("Sheet1").Range(Cells(2, 1), Cells(lastrow, 5)).Sort _
  Key1:=Range("E2"), Order1:=xlDescending
  </code></pre>