Macro is a tool in excel used to record every actions/keystroke performed by a user and reuse it when needed. The main advantage of using the macro is that it reduces lots of time through recording complex tasks as a macro with less
effort and reuse it when needed.
The way it works is recorded macro is stored inside a module in VBA editor as a VBA code and later it can be used to modify the code or run as it is recorded. Since macros are auto-generated by Microsoft excel itself, the code is more
accurate and it does not require any programming knowledge, and your job is done by a few clicks.
By clicking on record macro button at the bottom left hand side of the window.
Second way to record macro is through a shortcut key Alt + T + M + R, recommended as it saves few clicks.
Goto developer tab ---> Record macro.
Goto view tab ---> macros ---> record macro.
Once you click on any of these above methods a new record macro dialog box opens up.
Step 1:Now assign any name to your macro for reusing it in the future, note that your name should contain any space, number at the beginning, and no special characters.
Step 2:Next step is assigning a shortcut key to your macro, be careful in assigning shortcut keys as it may override the default keys. The alternate way to use shortcut keys is by using Ctrl + Shift + "your keys".
Example: Ctrl + s in excel is used for saving the workbook, if you use the same key to your macro it will override the default ctrl + s shortcut key and every time you press Ctrl + s your macro will open and Ctrl + s won't save your
Step 3:In this step, we have to decide where to store our macro?
As you can see we have 3 options to store our macro,
Personal Macro Workbook: You can choose this option if you want to use this macro in all of your workbooks, this option will store your macro in the default directory.
New Workbook: Opens up a brand new workbook and saves it.
This Workbook: Saves it in your current workbook in which you are currently working.
Step 4:Write any description about the macro, what it is for? what it does? etc and click OK.
Step 5:Now the macro is in record mode run through the steps you want to record or automate and click stop button at the bottom left-hand side of the window. Now you have successfully recorded a macro you can run it
by pressing Alt + F8 key and select the macro you want to run.
Every workbook with macros should be saved in a macro-enabled workbook type, which is in .xlsm extension.Check this video on how to save a macro.