title: VBA range("A1") command not working when I open different excel workbook
body: <p>My purpose is to copy rows from another Excel workbook and paste it back into my original Excel workbook</p>
  <p>This code works perfectly well if i remove line 2 and test it on my original Excel workbook that i am working on.</p>
  <p>But the moment i add in line 2 to activate another Excel workbook (&quot;Book1&quot;), and when i run the same code, this codes fails at the 3rd line. Error message is &quot;Application-defined or object-defined error&quot;.
  Strangely the first 2 lines works but until the 3rd line it fails. This only happens whenever i try to activate different excel workbook.</p>
  <p>I tried to convert the Excel files into same format such as xlsm, xlsx, csv but it still does not work. I tried for hours. Please explain to me what is the error. Thank You</p>
  <pre><code>Sub test()
  
  MsgBox ActiveCell.Value
  Workbooks(&quot;Book1&quot;).Activate
  Range(&quot;a1&quot;).End(xlDown).Select -----&gt;&gt;This line is where error occurs
  i = ActiveCell.Row
  Range(Rows(1), Rows(i)).Copy
  
  End Sub
  </code></pre>