• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Run Macro independent of worksheet

Danny

Member
Hi

I have created a macro, which in turn runs another macro I have created. It works fine on my local computer which was a sign of relief after much work. However, when I send it to my colleague it errors and when trying to debug it highlights a problem running the macro.

I am assuming its having a problem calling the macro when the workbook name is changed. My question is, can I run a macro independent of a work sheet name, meaning if someone Saves the file as another name the macro wont crash.

Many thanks
Danny
 

Attachments

  • RunMacro.PNG
    RunMacro.PNG
    32.2 KB · Views: 15
Hi Danny,

Try the below code for your issue.

wb = ThisWorkbook.Name

Application.Run "'" & wb & "'" & "!Macroname"


Regards
Abdul Matheen
 
Brilliant, I think that has worked.

I have another error further along in my code, so I'm assuming that has fixed that problem.

Now onto the rest.

Thank you once again.
 
Back
Top