Lucky you that I have some spare time at work :)
You will need recursion for your needs. A rough pseudo code for explanation:
processFiles(folder)
for each subfolder in folder
for each file in subfolder
Do modifications
next
call processFiles(subFolder)
next
end
In VBA, it looks like this:
Sub openAllXlsFilesInSubDirectoriesAndModifyThem()
Dim myPath As String
myPath = ThisWorkbook.Path
openAllXlsFilesInSubDirectoriesAndModifyThemRecursive (myPath)
End Sub
Private Sub openAllXlsFilesInSubDirectoriesAndModifyThemRecursive(currentFolder As String)
' Get a list of subdirs
Dim fileSystem As Object
Set fileSystem = CreateObject("Scripting.FileSystemObject")
Dim folder
Set folder = fileSystem.GetFolder(currentFolder)
Dim file
Dim Workbook
' Go down the folder tree
Dim subFolder
For Each subFolder In folder.SubFolders
' Go through all files in that subfolder
For Each file In subFolder.Files
' Check if the file has the right extension
Debug.Print file.Name
If Right(file.Name, Len(file.Name) - InStrRev(file.Name, ".")) = "xls" Then
' Open the file
Set Workbook = Workbooks.Open(file.Path & "\" & file.Name)
' Operate on the file
Workbook.Sheets(1).Range("A1").Value = "edited"
' Save the file
Workbook.Save
' Close the file
Workbook.Close
End If
Next
' Check all subfolders of this subfolder
openAllXlsFilesInSubDirectoriesAndModifyThemRecursive subFolder.Path
Next
End Sub