In some cases, a worksheet contains an operation that must be repeated regularly. You can create a macro to easily repeat it without having to follow the steps again. Follow this guide to learn how to save time with Excel macros.
Steps
Method 1 of 2: Use Macros in Excel (except Excel 2008 for Mac)
Step 1. Verify that macros are enabled in the settings
This setting is found in the "Security" section in most versions of Excel.
Step 2. Open the workbook that contains or will contain macros
Step 3. Verify that macros are enabled in that workbook
Step 4. Consider how you want to use the macro
You can run macros from a menu, link them to a workbook button, set them to run automatically when you open a worksheet, or link them to a keyboard command.
Step 5. Record or write your macro, to repeat the particular operations you want to automate, if there is not already a macro in your folder that you can use
To record the macro, find the "Record New Macro" command. The your operating system and your personal Excel configuration
Step 6. Open the macro menu, which you will usually find in the "Tools" section of Excel
Step 7. Test the macro you want to use, making sure it works correctly
Step 8. Assign the macro to any button, keyboard key, or auto-run on the worksheet
Step 9. Run the macro
Method 2 of 2: Use Macros with Excel 2008 for Mac
Step 1. Open the workbook where you want to insert the macro
Step 2. Open "Script Utility", which you will find in the "AppleScript" folder, inside your global "Applications" folder
(The global "Applications" folder is what you can see before opening your account root folder.
Step 3. Press the "record" button and perform the operations you want to insert into the macro
Step 4. Verify that the macro you recorded works correctly (Not all actions are automatable, which means that you cannot record them in an AppleScript)
Step 5. Save the AppleScript you recorded
Step 6. Run the AppleScript
Advice
- If you create your own macros, it will be easier to find errors if you log each operation individually. Check each section independently, and you will be able to edit any that contain errors. When everything works fine, turn the macro into a single program.
- If the macro was created on a different computer than the one you will be using it on, some changes will be required to run it correctly. Visual Basic for Applications (VBA, the programming language for Excel macros) is slightly different between the Windows and Mac versions.
- If you want to automatically enable macros, some versions of Excel allow you to save a macro-enabled workbook as an XLSM file and set preferences for particular folders where macros will always be accepted.
Warnings
- Viruses can hide in Excel macros. If a workbook contains an unfamiliar macro, verify that it was intentionally added by someone you trust.
- Macros can also damage Excel files, accidentally or intentionally. Be sure to back up your spreadsheet before activating a macro.