title: VBA - Copy a sheet to another workbook
body: <p>I want to copy a sheet (sheet2) from certain workbooks (paths in cell column "B") to another workbook (template).</p>
  
  <p>I tried the following one but Excel Return me the following error "Run-time error '1004': Application-defined or object defined error".</p>
  
  <pre><code>Private Sub SplitFile_Click()
    Dim C As Integer
    Dim x As Variant
    Dim Z As Workbook
  
    For C = 0 To 10
  
    Set x = ThisWorkbook.Sheets("SelectedFiles").Range("B" &amp; C)
    Worlbooks.Open("x").Sheets(Sheet2).Range("A1:U1000").Copy
    Set Z = Workbooks.Open("D:\PTP\MASTERDATA\SPACCHETTAMENTO FILE\TEMPLATE.Template.xlsx")
  
  
    Z.Sheets("SPLIT TAB").Range("A1:U1000").PasteSpecial
    Workbooks("Z").SaveAs Filename:="PROVA.xlsx"
    Next C
  End Sub
  </code></pre>
  
  <p>Can you help me?</p>
  
  <p>Thanks,
  Ivan</p>