title: Runtime Error 9 - Subscript Out Of Range
body: <p>I'm trying to create a form based interface using the VBA. I ran into a problem which I cannot figure it out. So in my code, I try to create a new workbook then save it. After that it will scan through the checkbox and see which one is getting selected. If it get selected, it will create a new sheet and copy the pre-made template. The user will open another workbook that they want and it will copy the information from that workbook to the workbook that just made. Here is the code for retrieving the data:</p>
  
  <pre><code>Sub mil10_data()
  
  Dim NewWB As Workbook
  Dim thisWB As Workbook
  Dim wb As Workbook
  Dim Ret
  
  Set thisWB = ThisWorkbook
  Set NewWB = ActiveWorkbook
  With NewWB
      'Copy the pre-made template to new workbook
      thisWB.Sheets("Data 10").Range("A1:AZ3000").Copy NewWB.Sheets(ActiveSheet.Name).Range("A1:AZ3000")
  
      'Retriving the data
      Ret = Application.GetOpenFilename("Excel Files (*.CSV), *.CSV", Title:="Select File To Be Opened")
      If Ret = False Then Exit Sub
      Set wb = Workbooks.Open(Ret)
      **'This is where the error is show up
      wb.Sheets(ActiveSheet.Name).Range("E21:E2136").Copy NewWB.Sheets(ActiveSheet.Name).Range("C2:C2117")** 
      wb.Close SaveChanges:=False
  
      Set wb = Nothing
      Set NewWB = Nothing
      End With
  End Sub
  </code></pre>
  
  <p>I figure that maybe because there are three workbooks open, it didn't know which one is the active workbook, but that is not the case. I tested by using the MsgBox and it display the right workbook and worksheeet name that I want. If I change the ActiveSheet.Name to the actual sheet name, it works, but I don't want to use that method. I have different worksheets that need to be created, so I prefer using the ActiveSheet.Name. Anyone know why it didn't work? I would really appreciate the help. Thank you!</p>