title: Excel VBA, getting range from an inactive sheet
body: <p>This script works fine when I'm viewing the &quot;Temp&quot; sheet. But when I'm in another sheet then the copy command fails. It gives an <code>Application-defined or object-defined error</code>:</p>
  <pre><code>Sheets(&quot;Temp&quot;).Range(Cells(1), Cells(1).End(xlDown)).Copy
  Sheets(&quot;Overview&quot;).Range(&quot;C40&quot;).PasteSpecial
  </code></pre>
  <p>I can use this script instead, but then I have problems with pasting it:</p>
  <pre><code>Sheets(&quot;Temp&quot;).Columns(1).Copy
  Sheets(&quot;Overview&quot;).Range(&quot;C40&quot;).PasteSpecial
  </code></pre>
  <p>I don't want to activate the &quot;Temp&quot; sheet to get this.</p>
  <p>What else can I do?</p>