Hi there,
I've got 13 files in directory (SMA (1).xlsm to SMA (12).xlsm plus "Data File.xlsm". I need to write code that opens each file (except one called "Data File.xlsm") runs "macro 3" in each file (same name in each file) and after that closes each file after saving changes. I have written the code and could not debug one of the lines. Would anyone help me please to sort this problem out? Thanks in advance.
Sub MasterKey()
'
' MasterKey Macro
Dim MyFolder As String
Dim Wb As Workbook
Set MyFolder = "C:\Users\Admin\Downloads\Excel Price Downloader\Daily Data"
For Each Wb In MyFolder
If Wb.Name <> "Data File.xlsm" Then
Wb.Activate
Application.Run _
"'C:\Users\Admin\Downloads\Excel Price Downloader\Daily Data\ *.xlsm!Macro3()"
ActiveWorkbook.Close True
SaveChanges = True
End If
Next Wb
End Sub
I've got 13 files in directory (SMA (1).xlsm to SMA (12).xlsm plus "Data File.xlsm". I need to write code that opens each file (except one called "Data File.xlsm") runs "macro 3" in each file (same name in each file) and after that closes each file after saving changes. I have written the code and could not debug one of the lines. Would anyone help me please to sort this problem out? Thanks in advance.
Sub MasterKey()
'
' MasterKey Macro
Dim MyFolder As String
Dim Wb As Workbook
Set MyFolder = "C:\Users\Admin\Downloads\Excel Price Downloader\Daily Data"
For Each Wb In MyFolder
If Wb.Name <> "Data File.xlsm" Then
Wb.Activate
Application.Run _
"'C:\Users\Admin\Downloads\Excel Price Downloader\Daily Data\ *.xlsm!Macro3()"
ActiveWorkbook.Close True
SaveChanges = True
End If
Next Wb
End Sub