Last week, I told you how to create a macro to insert custom headers and footers in your Excel documents. Now I'll show you how to make that macro, and any others you might create, even easier to use. You can create a custom button for your toolbar that will activate a macro in both Microsoft Excel and Microsoft Word.
Create a macro button in Microsoft Excel
The following directions were written using Microsoft Excel 2000. Instructions for other versions may differ slightly.
- Open a new workbook.
- From the Tools menu, choose Customize, as shown in Figure A.
- Click the Commands tab and then scroll down the left-hand Categories column and select Macros (see Figure B).
- You’ll see Custom Button in the Commands box. Click, hold, and drag the custom button onto any toolbar and release, as shown in Figure B.
- Right-click the new button and choose Assign Macro.
- Choose HeaderFooter and click OK. You may now change the button icon by right-clicking the button, choosing Change Button Image, and clicking on another icon, as shown in Figure C.
- Close the Customize dialog box.
You may now run your macro by clicking the button you've created. It will be available from all workbooks.
Create a macro button in Microsoft Word
Creating a macro button in Microsoft Word is similar to creating one in Excel. The following directions were written using Microsoft Word 2000. Instructions for other versions may differ slightly. Before starting the steps below, I created a macro, named PasteText, to paste unformatted text in Word documents. To create a macro button:
- Open a new document.
- From the Tools menu, choose Customize.
- Click the Commands tab and then scroll down in the Categories box and select Macros (see Figure D). You’ll see the names of any macros you've created in the Commands box on the right-hand side.
- Click, hold, and drag your macro onto any toolbar and release, as shown in Figure D. A button with the name of the macro will appear on the toolbar.
- To associate an icon with this button, right-click it, choose Change Button Image, and click on any icon (see Figure E).
- Next, right-click the button and choose Default Style. Your button will now appear as an icon only.
You may run your macro by clicking the button you've created. It will be available from all documents.
What's your favorite macro?
Have you created a great macro that others may benefit from? Send us the details in an e-mail message or post your comments below.