Background Information
Macros automate repetitive tasks by recording and re-playing a series of actions recorded in an Excel workbook. The following Job Aide provides the steps needed to record and replay a Macro. A common scenario for the creation of a Macro is to apply formatting to an Excel worksheet that was created as an output (report) by another program.
Macro Setup
- Open an Excel file that requires a repetitive task.
- Example: Apply identical formatting and/or functions to rows, columns, or cells in workbooks that are outputs of an Enterprise Application (report from SWS, CMP, etc.).
- Select cells that require formatting. If the range of cells does not change from file to file, select the exact range. If the Macro should be applied to a row or column as a whole, select the row header or column header.
- Review an example of this within the pdf attachment.
Record Macro
- Following Setup steps, select Record Macro. View Tab > Macros section > Macros drop-down > Record Macro.
- In the Record Macro dialog box, enter the following:
- Macro name (do not include spaces in the name)
- Add Shortcut Key to copy Macro.
- Note that existing shortcut keys will not save. Only unassigned shortcut letters will be saved as a shortcut key.
- Store macro in:
- This Workbook – Macro will save in this file only.
- Personal Workbook – Macro will be available in all workbooks opened from your user account.
- Description – add if needed
- Click OK to save Macro information and start recording.
- Using the example in the Setup section, the following actions would be recorded:
- Right-click Column E.
- Select Delete from the menu.
- Right-click Column G.
- Select Delete from the menu.
- When all actions are complete, click on the Macros drop-down, select Stop Recording.
Note: The Stop Recording button can also be found in the lower left corner of the Excel program. Look for the Blue Square.
View and Run Available Macros
- From the Macros drop-down, select View Macros.
- All available Macros are listed. Select the appropriate Macro and click Run.
- Save the file as a Macro-Enabled Workbook to keep the Macros available in the file.
More Macro Information
Advanced Macros to be used with cells including Formulas and Relative References are also available. For more information, log into Center for Learning, and search Advanced Macros. Select the course titled Automating Excel 2010 Tasks Using Macros.
Please note: Macro steps have not changed from Excel 2010 > Excel 2016 > Excel 365. All steps in the course video will apply to Excel 2016 and above workbooks.
To review images or save/download/print a copy of this Job Aide, please select the pdf attachment.