Running Macro Code from a Module when it is a Sub in a WS

EE Pros,

What code do I use to run a macro from a Module,  when  the macro I want to run is in a specific WS?  Do I have to declare the WS in the Module Code, or can I simply direct it with a single line in the Module code instructing the code to execute a Macro that is located in the WS?

Thank you in advance.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
The best thing to do is to move the macro to the Module and make it Public. You can then call it from worksheet events or any other module procedure.
ste5anSenior DeveloperCommented:
It depends only on the macro and how it references your worksheet. You need either to give the macro the worksheet name or index or it runs on the ActiveWorksheet object. In the first case you need further interaction/macro code. In the second case just activate the desired worksheet, then run your macro.
You can use the sheet code (not the name)
like this
Call Sheet1.MyMacroInSheet1

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Roy CoxGroup Finance ManagerCommented:
Macros should not really be stored in the WorkSheet.
Bright01Author Commented:
Roy,  Thanks for the comment.  Here's the challenge;  I'm simply trying to piece together the code you wrote previously for Save/Restore that had the Msg. confirmation (i.e. "Success") and have it display the confirmation in a cell rather then a msg. or a "shape".   I've been troubleshooting the code for several hours but cannot get it to work.
Bright01Author Commented:
Here is the macro that I was starting to incorporate.
Martin LissOlder than dirtCommented:
Try this. I moved the macro to newly created Module1.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bright01Author Commented:
Hey guys.....  you all gave me good advice on this challenge..... however, I realized after trying to incorporate everyone's suggestions that I was not going to be able to integrate something that should be simple as a stand alone question.  Therefore I have awarded the answers and closed the question only to open up a new one with the actual code that requires embedding the logic to change a msg box to a cell reference for the confirmation of data being saved and restored.  With the full file, you can see what I'm simply trying to accomplish.

Thank you all... and I hope one of you will pick up the new post.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.