How to Use Macro in Excel With Examples

by Stephanie Ellen

Excel macro recording replaces repetitive tasks with a couple of mouse clicks or a keyboard combination. For example, if you frequently format expense sheets, you can get a macro to do the formatting for you (you only have to format the document once, while Excel records your keystrokes and mouse clicks), or you can get Excel to open a particular file that you frequently use without having to click through a series of sub menus.


Start Excel. A new workbook is automatically opened for you.


Open the macro recording window. In Excel 2003, click on "Tools > Macro > Record New Macro" and in Excel 2007 click "View > Macros > Record Macro."


Type in a meaningful name in the macro box according to what you want to record: for example "OpenTaxFile," or "MakeExpenseSheet."


Enter a shortcut key for your macro in the "Shortcut key" box. For example, enter a "O" to assign the keys "Ctrl" and "O" to your macro.


Click on "OK." The macro recorder is now running.


Perform the task that you want the macro to automate. For example, open a particular file by click on "File > Open" in Excel 2003, or "Office > Open" in Excel 2007 and then locate the file. You can also format a spreadsheet: for example, make an expense sheet by typing in any information that you want contained on the sheet, like mileage and business expenses.


Stop macro recording by clicking on "Macro > Stop Recording." Your macro is now ready for testing and use.


  • check You can access your macro in one of two ways: click on "Macros" and select the macro to run it, or press the key combination you assigned in Step 4.

About the Author

Stephanie Ellen teaches mathematics and statistics at the university and college level. She coauthored a statistics textbook published by Houghton-Mifflin. She has been writing professionally since 2008. Ellen holds a Bachelor of Science in health science from State University New York, a master's degree in math education from Jacksonville University and a Master of Arts in creative writing from National University.

More Articles

Photo Credits

  • photo_camera number background image by kuhar from