title: Try to Copy Data From one Workbook to another Workbook in Excel
body: <p>I'm trying to create a macro in Excel that allow me to copy and paste data from one workbook to another workbook. The workbook names are always going to be different, so I used GetOpenFilename() method and stored it in a variable, so I can specifically choose the workbook I want. However, I am getting a runtime 9 error.</p>
  <p>Here's the code so far. (macro1 is just another macro I created that crunches numbers)</p>
  <pre><code>Sub Everything()
  
  Dim f1 As String 
  Dim f2 As String 
  Dim wb1 As Workbook
  Dim wb2 As Workbook
  
  f1 = Application.GetOpenFilename(FileFilter:=&quot;Excel Files,*xl*;*xm*;&quot;)
  Set wb1 = Workbooks.Open(f1)
  
  f2 = Application.GetOpenFilename(FileFilter:=&quot;Excel Files,*xl*;*xm*;&quot;)
  Set wb2 = Workbooks.Open(f2)
  
  Call Macro1
  
  Workbooks(wb2.Name).Worksheets(&quot;Sheet1&quot;).Range(&quot;D4:D25&quot;).Copy _
  Workbooks(wb1.Name).Worksheets(&quot;Sheet1&quot;).Range(&quot;E11:E32&quot;)
  
  End Sub
  </code></pre>
  <p>I get the run time error on the very last two lines of code.
  Please help, thank you!</p>