We will discuss the following in this post:
- What are Macros?
- How to create Macro in Excel 2010
- What is Relative References
- How to run a Macro in Excel 2010
What are Macros
Do you often perform the same repeated tasks again and again in Excel? A macro records your mouse clicks and keystrokes while you work and play them back later. It is used to record the sequence of actions you use to perform a certain task. When you run the macro, it plays those actions back in the exact same order. Thus, saving you headache if you want to repeat the actions multiple times.
Create/Record Macros In Excel 2010
Hit the View menu and choose the Macros > Record Macro.
The Record Macro dialogue box will be displayed, here specify the details of the Macro. Macro names must start with a letter and can include letters, numbers, and underscore characters. You can specify the shortcut key to run the Macro here, also for better understanding of the Macro specify the Macro description.
View in gallery That’s it, now perform your steps and Excel will keep recording all the steps, when you are done, stop the Macro recording from the Macro > Stop Recording option.
What is Relative References
By default, Excel Macro Recorder records your absolute steps. Lets suppose you want a to move from cell A8 to B8 after performing an action, you will press the Right Arrow key, but Excel will not record this key, instead it will only record the movement to cell B8. Now lets suppose you have recorded the actions and are to perform it in cell C8, when you run the Macro, a line of Macro will be executed and then cell B8 will be selected instead of selecting cell D8(which is to the right of C8).
Like I said above, this is because Excel records the movement to cell B8 instead of recording every action(keystroke). If you want Excel to record relatively, so that Excel moves to the right cell instead of selecting cell B8, you will have to enable Relative References. It can be switched on from the Macros menu just below the Start/Stop Recording option.
Run Macros In Excel 2010
Once you have recorded the Macro, you will not need to perform the repeated steps again and again any more. Hit the Macro > View Macros option and it will display the list of all the created/recorded Macros. Choose your desired Macro and hit the Run button. You can also edit and delete Macros from here.
A much more easier method is to hit the shortcut key(hotkey). If you forgot to assign a shortcut key, simply head over to View Macro, select the desired Macro and hit Options, now assign a hotkey and hit OK.
The third method is even more easier if you are not a hotkey junkie, simply add the Macro to the Quick Access Toolbar. Now one click is all that is needed to execute a macro.