Getting a Macro to work in another workbook

alsu53

New Member
Joined
Sep 6, 2011
Messages
1
Hi Excel experts. Your help please - with simple non technical answers.

I'm creating macros and saving them to PERSONAL.xls.

Now some of the macros will work on any workbook, but some won't.

When I look at those macros (in edit) which don't work, they are looking for worksheets named as per the worksheet on which I created them.

So, why do some of my macros run on any worksheet/ book and some not.

I can't see what I'm doing differently

Help!!!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Macros destined for the PERSONAL.XLS must be edited to refer to either:

1) The Activesheet, thus all commands apply to the active sheet at time of execution
2) A sheet the macro finds and stores in a worksheet variable, then uses the worksheet variable to continue to apply to that sheet.


It sounds like you already see the problem. Try to associate all commads to the "activesheet", or post the code here and we'll offer specific suggestions.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

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