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?
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
It should run in any sheet in the current workbook.

If you want it to run in different workbooks (files), that is different.
 

stevebausch

Well-known Member
Joined
May 11, 2002
Messages
810
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,822
Messages
5,598,304
Members
414,224
Latest member
Crazy_FC

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
Top