I'm trying to run a macro on a different sheet from the one

afs24

Board Regular
Joined
Sep 26, 2002
Messages
237
I created a macro and I want to be able to run it from any sheet in my workbook not just the one I created it in. Should I record the macro under new workboo?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
It should run in any sheet in the current workbook.

If you want it to run in different workbooks (files), that is different.
 
Upvote 0
If the macro is in a standard module, you should have access to it.

As long as the module is not spec'd as Option Private Module.

We are talking about a Sub, not a Function, correct?

My 'checklist' for access to a Sub/Function is:

Make sure you are spelling the name correctly.

Is Intellisense 'popping up' and prompting for arguments?

You won't need to use parentheses when calling a Sub. At best, they get in the way, causing a compile-time error. At worst, parentheses may be interpreted as type-forcing, causing a run-time error. If your Sub all of a sudden returns "Object Required" run-time errors, look for 'extra' parentheses.

With a function, you need to have the arguments enclosed in parentheses IF you are wanting to assign the result of the function. You could call a function without enclosing arguments within parentheses; just don't assign the result to anything.
 
Upvote 0

Forum statistics

Threads
1,216,487
Messages
6,130,945
Members
449,608
Latest member
jacobmudombe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top