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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use default macro for new books

Status
Not open for further replies.

daveonion

Programmer
Joined
Aug 21, 2002
Messages
359
Location
GB
Hi, what i need to know is how to customize excel so i can attach the same macro to every new book created. For instance when importing information there is a lot of information not needed so i need to keep the same macro to delete all unwanted columns, however it is to messy to write it out each time i create a new spreadsheet so is there a way to have a button attached to the menu bar for every new sheet created.
 
Dave,

If I understand your question correctly, the following should work:

Open a new workbook and record/write the macro(s) that you use often. Assign key shortcuts to them, or attach them to buttons (less desirable because you will have to delete the buttons each time after you are done). While you are at it, apply any formatting and headers/footers you always use. Now use "Save As" to save the workbook as "MyTemplate", being sure to select Save As Type: "Template".

Whenever you want a new document to have this formatting and those macros available, go to File>New (NOT the little toolbar icon). You should see "MyTemplate" as one of the options. You can now edit and save at will without changing your template.

I keep a number of these templates ready for various different tasks I do frequently. A huge time-saver!

If you REALLY want to assign a macro to a toolbar button and have it always available, it is possible (it's just a lot more work). But the macro will not be attached to your document, so it won't be available if you or someone else opens that document on another machine.

Hope this helps you!

VBAjedi [swords]
 
Actually, I think you want to create a personal.xls file. I'm assuming that you want the macro to be AVAILABLE in all files, but not STORED in all those files, is that correct?

Use a personal.xls file--see the help file to learn how, or ask back. :) Anne Troy
Word and Excel Macros
Coming soon: wX
 
thanks vbijedi however anne your idea seems to be the most appropriate could you write back with instructions please
thanks

dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top