I avoid working with multiple workbooks like the plague it's a pain, if this is an ongoing requirement then I would suggest looking back to your workbook design and seeing if you can consolidate back to one workbook. I often see workbooks each saved month by month when they should have one workbook with one sheet with raw data where each row represents a month, then another sheet for display which looks up the raw data chosen by the user. Thats a very big generalisation and you could well be in a totally different situation.
If its a once off - and I know its not what you wanted but I think you would be best to loop through the workbooks using VBA. Something like (untested):
Excel 2003:
Sub AdjustMultipleFiles()
Dim lCount As Long
Dim wbLoopBook As Workbook
Dim wsLoopSheet As Worksheet
With Application
.ScreenUpdating = False: .DisplayAlerts = False: .EnableEvents = False
End With
With Application.FileSearch
.NewSearch
'// Change path to suit
.LookIn = "C:\MyDocuments"
'// ALL Excel files
.FileType = msoFileTypeExcelWorkbooks
'// Uncomment if file naming convention needed
'.Filename = "Book*.xls"
'// Check for workbooks
If .Execute > 0 Then
'// Loop through all.
For lCount = 1 To .FoundFiles.Count
'// Open Workbook x and Set a Workbook variable to it
Set wbLoopBook = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
'// Loop through all worksheets
For Each wsLoopSheet In wbLoopBook.Worksheets
'//Update your worksheets here...
Next wsLoopSheet
'// Close Workbook & Save
wbLoopBook.Close SaveChanges:=True
'// Release object variable
Set wbLoopBook = Nothing
Next lCount
End If
End With
With Application
.ScreenUpdating = True: .DisplayAlerts = True: .EnableEvents = True
End With
End Sub
For EXCEL 2007+:
Sub AdjustMultipleFiles()
Dim sFileName As String
Dim wbLoopBook As Workbook
Dim wsLoopSheet As Worksheet
With Application
.ScreenUpdating = False: .DisplayAlerts = False: .EnableEvents = False
End With
'// Change path to suit
ChDir "C:\Documents"
'// ALL Excel 2007 files
sFileName = Dir("*.xlsx")
Do While sFileName <> ""
'// Open Workbook x and Set a Workbook variable to it
Set wbLoopBook = Workbooks.Open(Filename:=sFileName, UpdateLinks:=0)
'// Loop through all worksheets
For Each wsLoopSheet In wbLoopBook.Worksheets
'//Update your worksheets here...
Next wsLoopSheet
'// Close Workbook & Save
wbLoopBook.Close SaveChanges:=True
'// Release object variable
Set wbLoopBook = Nothing
'//Next File
sFileName = Dir
'//End Loop
Loop
With Application
.ScreenUpdating = True: .DisplayAlerts = True: .EnableEvents = True
End With
End Sub
Excel 2007 + (FileSystemObject - LateBinding)
Sub AdjustMultipleFiles()
Dim wbLoopBook As Workbook
Dim wsLoopSheet As Worksheet
With Application
.ScreenUpdating = False: .DisplayAlerts = False: .EnableEvents = False
End With
With CreateObject("Scripting.FileSystemObject")
'// Change path to suit
For Each File In .GetFolder("C:\Documents").Files
'// ALL Excel 2007 files
If .GetExtensionName(File) = "xlsx" Then
'// Open Workbook x and Set a Workbook variable to it
Set wbLoopBook = Workbooks.Open(Filename:=File.Path, UpdateLinks:=0)
'// Loop through all worksheets
For Each wsLoopSheet In wbLoopBook.Worksheets
'//Update your worksheets here...
Next wsLoopSheet
'// Close Workbook & Save
wbLoopBook.Close SaveChanges:=True
'// Release object variable
Set wbLoopBook = Nothing
End If
Next File
End With
With Application
.ScreenUpdating = True: .DisplayAlerts = True: .EnableEvents = True
End With
End Sub