A macro is a set of instructions that the user has recorded in Excel which can be used to automate certain tasks. Users can record some complex tasks that they come across frequently and let the Excel do all the work in the future. This makes the task more streamlined and also saves some time.
Macro records all the steps that the user performs in a Visual Basic for Applications (VBA) which is a subset of a more powerful Visual Basic programming language.
However, there are several things that a user should keep in mind while recording a macro.
- Make sure that the steps are accurate. In case the steps are inaccurate, you will have to delete the macro and then restart the whole process.
- If the process is long, it is recommended that you break the process in smaller bits and then record the macro for each bit.
- There are tons of tools that use the Visual Basic for Application to record. This allows greater portability for the recorded macro. For example, you can record a macro in Excel or Word and then can export the macro to Outlook.
- Macro only runs within the specified cell range that you have selected. This means that if you add an extra row or column, you cannot run a macro.
But before you can record a macro, you’ll have to enable the developer option in Excel. Below is a guide to enable dev options, followed by one to record macros as well as how to run, edit and delete them.
Also read: How to schedule an email in Outlook?
Turn on the Developer tab
Before you carry on with recording the macro, first you will have to enable the developer option. Here are the steps to enable the developer option in Excel.
Step 1: Open Excel worksheet and then click on the File option at the top left.Step 2: Next select the Options option at the last.Step 3: Now select the Customised ribbon option form the menu.Step 4: After that, select the Developer option from the Main Tabs heading. Your developer option is now enabled. Also read: How to set and remove password in Excel?
Record macro in Excel
Now that you have enabled the Developer options, here are the steps to record a macro in Excel on the computer.
Step 1: Open the spreadsheet and then click on the Developer option at the top. Step 2: Now, click on the Record Macro option. Alternatively, you can type Alt + T + M + R. You will see a window where you can modify the macro as per your requirement. Step 3: Enter the name of the macro. Remember to enter the name as descriptive as you can make. It will help you in finding the macro easier. Also, note that the first name of the macro should be a letter. You can add other characters after the first letter. Apart from that, your macro name should not be the same as a cell reference. Step 4: Now, select an appropriate shortcut for your macro. You must note that the shortcut that you enter should not be part of Excel’s standard shortcuts. For example, if you use Ctrl + C (copy command), then you cannot use the same shortcut outside the macro. Step 5: Next, you can store the macro in either this workbook or in a new workbook. You can also create a new personal macro workbook to store the macro. Step 6: Type the description of the macro. Although this step is optional, it is highly recommended. By writing the description, you will understand the functionality of the macro, in case, you come across it in the future. Step 7: When you are done formatting the macro, click on OK to start recording the macro.Step 8: Record the steps carefully and then click on Stop Recording from the same Developer tab. Alternatively, you can press Alt + T + M + R to stop the recording.
Run, Edit and Delete the macro
If you want to run the macro, go to Developer > Macro > Run. Similarly, you can delete, edit and perform other modifications to the macro from this option.
Also read: How to display and hide formulas in Excel?