Make macro available in other workbooks

yorkshirelad

Board Regular
Joined
Aug 18, 2003
Messages
100
Hi this is probably a simple question but its driving me nuts.

I have recorded a macro that works fine in the saved file but I need it to be available for new workbooks.

The macro removes redundant rows and columns from data saved from a browser. As the data is exported using a right click option (export to Microsoft Excel) I can't select a particular Excel file, it automatically selects a new workbook.

Many thanks

Yorkshirelad
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi

Saving the code down to your Personal macro Workbook would then allow you to use it with other workbooks. If you have never created a Personal Macro Workbook before, then go Tools>Macro>Record New macro. In the dialog that opens, select Store Macro In: Personal Macro Workbook. Click OK and immediately click Stop Recording.

This will create your PMW. Open up the VBE (Alt+F11) and you should see it listed in the top left projects Window. Open up the module within it and copy your code that you want to run into the PMW's code module. Save the PMW down by clicking the Save icon in the VBE.

Now you should be able to run the macro via Tools>Macro>Macros and choose to list the macros in your Personal.xls (which is what your Personal Macro Workbook is actually called). It is saved down to your XLSTART folder and opens up automatically when Excel is started. You don't see it as it is saved in a hidden state.


Note you may need to amend your current macro code to ensure it works on the Activeworkbook rather than one with a specific name. If this is the case, please post back with your current code.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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