title: Out of Range error copying data from one workbook to another
body: <p>Hello all I am very very new to VBA just not old to Excel, and I'm attempting to write a macro that will allow a user to select a file, and then copy 2 separate ranges of data from that file and paste it into the original Active workbook.</p>
  
  <p>Ok so after reviewing this I've changed my code to this:   </p>
  
  <pre><code>Sub GetFastScanData()
  
  'Add file name to Active Sheet
  Dim intChoice As Integer
  Dim strPath As String 
  
  Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
  intChoice = Application.FileDialog(msoFileDialogOpen).Show
  
  If intChoice &lt;&gt; 0 Then
    strPath = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
    Cells(1, 1) = strPath
  
    'Open Source WorkBook
    Dim sourceWB As Workbook
    Set sourceWB = Application.Workbooks.Open(strPath)
  
    'Give names to items
    Dim Var1 As String
    Var1 = "BT16"
  
    Dim Var2 As Integer
    Var2 = 1
  
    Dim Var3 As String
    Var3 = "BU16"
  
    'Copy from Source to Target
    sourceWB.Sheets(Var2).Range("F1:F55000").Copy _
      Destination:=Workbooks.Sheets("PI-2 data").Range(Var1)
  
    sourceWB.Sheets(Var2).Range("I2:I55000").Copy _
      Destination:=Workbooks.Sheets("PI-2 data").Range(Var3)
  
    'Close Source WorkBook wo/Save
    sourceWB.Close False
  
  End If
  
  End Sub
  </code></pre>
  
  <p>My only problem now is that I think I'm getting an error due to the 12/9/2014 windows update? Compile Error: Data not Found</p>
  
  <hr>
  
  <p><em>original post:</em></p>
  
  <p>I'm really new with VBA, but i'm definitely not a rookie to Excel. I have an issue with a macro that is attempting to copy data from a selected file to the current workbook. I'm getting the out of range error for the italicized portion of the macro. Any help is greatly appreciated!</p>
  
  <pre><code>Sub GetFastScanData()
  
      'Add file name to Active Sheet
      Dim intChoice As Integer
      Dim strPath As String
      Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
      intChoice = Application.FileDialog(msoFileDialogOpen).Show
      If intChoice &lt;&gt; 0 Then
      strPath = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
      Cells(1, 65) = strPath
  
      'Open Source WorkBook
      Application.Workbooks.Open (strPath)
  
      'Give names to workbooks and items
      Dim Var1 As String, Var1R As String
      Var1 = ActiveWorkbook.Name
      Var1R = "BT16"
  
      Dim Var2 As String, Var2R As String
      Var2 = ActiveWorkbook.Name
      Var2R = 1
  
      Dim Var3 As String, Var3R As String
      Var3 = ActiveWorkbook.Name
      Var3R = "BU16"
  
      'Copy from Source to Target
      *sourceWB.Sheets(Var2R).Columns(6).EntireColumn.Copy _
      Destination:=Workbooks(Var1).Sheets("PI-2 data").Range(VarR1)*
  
      Sheets(Var2R).Columns(9).EntireColumn.Copy _
      Destination:=Workbooks(Var3).Sheets("PI-2 data").Range(Var3R)
  
      'Close Source WorkBook wo/Save
      Workbooks(Var2).Close False
  
      End If
  
  End Sub
  </code></pre>