How to Create and Use Excel Macros
Microsoft Excel has a feature called macros, which records of a set of actions. You can record common processes and run them later to automate your actions. Follow these steps to create and run a macro.
1. Enable the Developer Tab
Macros are housed in the developer tab of Excel. Since this tab is hidden by default, you need to enable it. Right-click on the Excel ribbon and select “Customize the Ribbon.” In the dialog window, check the box by “Developer” in the right-hand list and click “OK.”
2. Record Your Excel Macro
In the “Code” group of the developer tab, click “Record Macro.” In the dialog box, enter these details:
- Macro name: Add a recognizable name for your macro.
- Shortcut key: Choose a key for a macro shortcut. When you use this shortcut in Microsoft Excel, the macro will run.
- Store macro in: Select “This Workbook” for the macro to work in your current worksheet.
- Description: Add a short description of what this macro can do.
Now, click “OK” to save these details and start the recording. Perform the actions you want to automate for the macro, and then click “Stop Recording” in the developer tab when you’re done.
3. Edit the Macro
You can use the Visual Basic for Applications (VBA) programming language to edit your macro. In the “Code” group of the developer tab, click “Macros.” In the list of your macros, click on the macro you want and select “Edit.”
The Visual Basic Editor shows the actions you completed to create the macro in code form. You can edit this code to remove, add, or change the actions the macro automates.
4. Run Your Macro
See your saved macros by clicking “Macros” in the developer tab. In the drop-down box, click on the name of the macro you want to run. Click “Run,” and the macro executes the recorded actions. However, you can also run a macro using the shortcut key assigned in step one.
5. Save Your Excel Macro Workbook
Save your workbook by clicking “Save As” under the “File” menu. Choose “Excel Macro-Enabled Workbook (.xlsm)” in the drop-down menu for “Save as type.” Then, save the workbook to save your macro features.
Note that a workbook with macros must be saved as an XLSM file instead of an XLSX file. If you try to save your macro workbook as an XLSX file, Excel will display a warning window. Exit this dialog box by clicking “No.”
Learn More About Our Managed IT Services
Agio offers managed IT services to give your team a frictionless IT experience. With 24/7 user support, proactive monitoring, and more, your company can focus on your critical operations while we manage your IT. Contact us today to learn more.
Connect with us.
Need a solution? Want to partner with us? Please complete the fields below to connect with a member of our team.