Macro
Macro:
This section will teach you how to record simple macros and what exactly a macro is.
Brief introduction of Macro
Macro is a very powerful productivity tool. A macro is a sequence of instructions or set of tasks combined so you can run or replay the entire sequence or set with a single command. You may create a macro, for example, to print or format your sales report. Once a macro is developed, with one click you can execute the macro to perform the time-consuming procedure automatically.
VBA is the language we use to create a macro. In Excel, the Record Macro feature on the Developer toolbar is a great feature. Without knowing VBA language you can create simple and useful macros. For complex programming you have to have an understanding of VBA language. In summary, this is one of the most powerful tools of MS Excel.
What can we do with Macro’s?
The answer to this question is very simple: we can use Macro for anything and everything that is repetitive. For example, if you are preparing the same kinds of reports on a daily basis, you can create a macro that will prepare the reports with one click of your mouse.
How to record a simple Macro?
Step 1 – Open Excel workbook, select worksheet 1 and go to Developer tab.
Step 2 - Click on Record Macro. The window below will open.
Macro name – You can replace the name of the Macro to be recorded to fit your needs. Macro1, Macro2, etc. is the default name.
Shortcut Key – You can assign the macro to a shortcut key; for example, if you type A in the box, you can execute or run the macro by pressing Ctrl+A.
Store macro in – This is the name of the workbook where you want to keep the macro, e.g. This workbook, New workbook, etc.
Description – You can define the macro so it shows what will happen when the user runs the macro.
Click OK to record the macro.
Step 3 - write at Range A1 = Workbook, B1 = Worksheets, C1 = Range, then select worksheet select and select Range A1:D1.
Now click on Stop Recording
Step 4 – You have created a macro by the name of Macro1. To run this macro, click on Macros or press the shortcut key if you have assigned one.
Step 5 – Select the Macro you have created and click on Run. This macro will do the same task you did manually in worksheet one and worksheet two. In simple words, this recorder tool has recorded the steps you performed in the Excel workbook, and when you click on the Run button it will do the same thing.
Below is the code of the recorded macro. This is just example of basic steps for how to record a macro. Using the same process, you can record anything you do in Excel and get the valuable code.
Now you understand the basics of Excel Macro’s. For the next step, see the page on VBA, the programming language for Excel Macro’s.