title: How to edit multiple excel files each of which are in a different folder united in one folder
body: <p>This question isn't supposed to be complicated. I have one big folder and in it it has 200 individual folders. Now each of those folders has one excel sheet in it. I want to have some code in a vba file in control folder (which is next to the 200) which can iterate over the 200 folders and change one bit of data in each excel file. I found directory stuff and folder iterations, However I can't take bit for here and there and merge them together, i need some simple help.</p>
  
  <p>my code is currently: `Sub Button1_Click()</p>
  
  <pre><code>Dim wb      As Workbook
  Dim ws      As Excel.Worksheet
  Dim iIndex  As Integer
  Dim strPath As String
  Dim strFile As String
  
  'Get the directories
  strPath = "C:\Users\generaluser\Desktop\testing main folder\"
  strFile = Dir(strPath, vbDirectory)
  
  'Loop through the dirs
  Do While strFile &lt;&gt; ""
  
      'Open the workbook.
      strFileName = Dir(strPath &amp; strFile &amp; "New Microsoft Excel Worksheet.xlsm", vbDirectory)
      'Open the workbook.
      Set wb = Workbooks.Open(Filename:=strPath &amp; strFile &amp; "\" &amp; strFileName, ReadOnly:=False)
  
      'Loop through the sheets.
  
      Set ws = Application.Worksheets(1)
  
      'Do whatever
  
  
  
      'Close the workbook
      wb.Close SaveChanges:=True
  
      'Move to the next dir.
      strFile = Dir
  Loop
  </code></pre>
  
  <p>End Sub
  ` </p>
  
  <p>Please help @MatthewD</p>