Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to save a excel macro to use in other excel sheets 1

Status
Not open for further replies.

SweetDot

Technical User
Jan 19, 2004
65
US
Hi,
Is it possible to save an excel macro so that it can be used in other excel sheets? Would the export and import function work? I want to be able to run the same macro on many different files, and these files are data files created by another program, so there's no way to know what the file names are in advance.
Please help!!

thanks
Hillary
 
Easiest way is to save the macro to a PERSONAL.XLS file

Easiest way to create this is to record a new macro (can be as short as you like) but rather than using the default "Store Macro In" option of "Thisworkbook", use the dropdown to select "Personal Macro Workbook"

This will automatically create the personal.xls file and put the macro in there

Go into the VBEditor and delete the recorded macro and simply copy and paste the macro you want to be available to all workbooks in its place

Save the Personal.xls file by clicking the save button in the VBEditor et voila - you now have a Personal.xls file that will open whenever you open excel (it'll be hidden tho) so the macros will always be available


Course, the other way is to create your own add-in (.xla file) but that can get complicated...

Rgds, Geoff

Yesterday it worked. Today it is not working. Windows is like that.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top