Application.Run

JTL9161

Active Member
Joined
Aug 29, 2012
Messages
337
I have the below code at the end of a macro after switching from workbook (A) to the MMDDYY-SGCS workbook. The entire macro runs in WB(A) then the code below switches to the MMDDYY workbook.

Windows("MMDDYY-SGCS.xlsm").Activate
Sheets("Sheet1").Select
Range("B2").Select

'Application.Run "MMDDYY-SGCS.xlsm!SGPDNORX"
Application.Run Application.ActiveWorkbook.Name & "SGPDNORX"

End Sub

I have tried both Application.Run's listed here (disabling one of them each time) and ever time I get the

Runtime Error 1004' Cannot run the macro "SGPDNORX" The macro may not be available in this workbook or all macros may be disabled."

I have checked the spelling and even did a recorded macro to get the exact code needed and still the same error.

Any help appreciated.
James
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,466
Office Version
365
Platform
Windows
Are there any spaces in the name of the workbook with the 'SGPDNORX' code in it?
 

Watch MrExcel Video

Forum statistics

Threads
1,089,970
Messages
5,411,577
Members
403,380
Latest member
ifog671

This Week's Hot Topics

Top