title: How to copy data from csv file to other excel files
body: <p>Since I am new to VBA I created a code which can open a .csv file and copy data from .csv to an excel file without opening both.</p>
  
  <p>Actually it works for excel files but When I use a .csv file it displays me an error message "SUBSCRIPT OUT OF RANGE".How do I solve this? Thank You!</p>
  
  <pre><code>    Sub Copywb1()
      Dim wkb1 As Workbook
      Dim sht1 As Worksheet
      Dim wkb2 As Workbook
      Dim sht2 As Worksheet
  
  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  Application.EnableEvents = False
  
  Setwkb1 = ThisWorkbook
  Setwkb2 = Workbooks.Open("C:\Desktop\AAA.xlsx")
  Setwkb1 = Workbooks.Open("C\Reports\BBB.csv")
  Setsht1 = wkb1.Sheets("Reports")
  Setsht2 = wkb2.Sheets("Fees")
  
  sht1.Range("A1:BM9").Copy
  sht2.Range("A1").PasteSpecial xlPasteValues
  Application.CutCopyMode = False
  wkb2.Close True
  wkb1.Close True
  
    End Sub
  </code></pre>