title: Copy single sheet from multiple workbooks and paste in a single workbook
body: <p>I am trying to use VBA in order to automate a boring work process. I don't know the language so I copied a code from the internet which is as follows:</p>
  <blockquote>
  <p>Problem statement: I have multiple excel files in one folder, from
  them I have to extract a single sheet named &quot;sheet 1&quot; <strong>(all the files
  have it, but sheet1 isn't the only sheet those workbooks have)</strong>.</p>
  <blockquote>
  <p>Then I have to paste them in a new workbook. (I don't mind
  if each of them are in different sheet, because I'll just record a
  macro to compile them later on)**</p>
  </blockquote>
  </blockquote>
  <p>Does anyone have any suggestions?</p>
  <pre><code>   Sub Combine_files()
  Dim Path As String
  Dim Filename As String
  Dim Sheet As Worksheet
  
  Path = &quot;C:\Users\prayag.purohit\OneDrive\Desktop\Project KC\New folder\&quot;
  Filename = Dir(Path &amp; &quot;*.xlsx&quot;)
  Do While Filename &lt;&gt; &quot;&quot;
  
  Workbooks.Open Filename:=Path &amp; Filename, ReadOnly:=True
  
      For Each Sheet In ActiveWorkbook.Sheets
          Sheet.Copy After:=ThisWorkbook.Sheets(1)
      Next Sheet
  
  Workbooks(Filename).Close
  
  Filename = Dir()
  Loop
  End Sub
  </code></pre>