Recording a Macro
Duration: 10 to 20 minutes.
In this exercise, you will record a macro that adds a custom header and footer to a Microsoft Excel workbook.
- Open Macros.xlsx from your Excel2013.3/Exercises folder.
- Record a macro named "CustomHF" to add a custom header and footer to your workbook. Specifically, the macro should:
- Add the word "CONFIDENTIAL" in the center of the header.
- Add the date on the right side of the header.
- Add the page number to the center of the footer.
- On the VIEW tab, in the Macros group, click the Macros command:
- Click Record Macro:
- In the Record Macro dialog box:
- Enter the Macro name of "CustomHF".
- Enter a Shortcut key.
- Accept the default to store the macro in this workbook.
- Enter a Description such as "Custom header and footer."
- Click OK.
- After clicking OK, every keystroke is recorded. Following are specific instructions:
- Click FILE, then Print, and then Page Setup:
- Select the Header/Footer tab and then click Custom Header:
- Tab to or click in the Center section and type "CONFIDENTIAL". Then tab to or click in the Right section, click the Insert Date icon, and then click OK:
- Click Custom Footer:
- Tab to or click in the Center section, click the Insert Page Number icon, and then click OK:
- You are now back in the Page Setup dialog box. Click OK:
- On the VIEW tab, in the Macros group, click the Macros command and then click Stop Recording: