Reputation: 97
Ok I feel stupid for asking this as there are dozens of questions out there asking the same thing. But for some reason it's just not working out for me. I have two workbooks "Historical Data.xlsm" and "Reporting File 2.0.xlsm", and "Reporting File 2.0" is protected so I can't create any new macros within it. I want to run a macro within "Historical Data" by clicking a (assign macro) button in "Reporting File 2.0"
So I created two macros in "Historical Data", one that is the macro I want to run and a second that runs this macro, with the code:
Sub RunMacro()
Application.Run ("Historical Data.xlsm!ShiftRow1")
End Sub
But I keep getting a "Run-time error: 1004: Method 'Run' of object '_Application' failed"
If someone could direct me into the right direct that would be greatly appreciated.
Upvotes: 1
Views: 3411
Reputation: 6433
You are missing single quotes (a must have if your workbook name has a space).
If the ShiftRow1
is indeed in Historical Data.xlsm, you should do:
Sub RunMacro()
Application.Run "'Historical Data.xlsm'!ShiftRow1"
End Sub
Upvotes: 4