Macros

. Macros is a software available with most of Windows Applications like Word, Excel.
. By using Macro we can record a task.
. It is very useful when you have a task that you need to perform repeatedly. 
. It speeds up the procedure and assures accuracy.

Creation of Macros:

. First we need to enable Developer toolbar.
  > Right click on Ribbon tab. 
  > Customize Ribbon.
  > Select Developer.
  > Ok.

Recording a Macro:

. We work with Macros in Developer toolbar.
. Select Use Relative References.
. Record Macro.
. Enter all the details the pop-up asked for.
  > Macro name: Name of macro in which we store the task.
  > Shortcut key: It enables to run macro using shortcut key.
  > Store macro in: Choose 'Personal Macro Workbook' to use Macro in all sheets.
. Perform task which we want to store.
. Example: A table of Student details is stored for future use.
. Now click on Stop Recording. 

Running a Macro:

We can run Macro in 2 ways.
  1. Using Shortcut Key we assigned:
   2. Click on Macros > Select Macro > Run.
      To open Macros we can use Alt+F8.

Inserting Controls as Macros:

. We can also perform repetitive tasks using controls.
. Click on Insert > Select Controls> Drag control to desired position.  

. Select Design Mode and change properties of the control.
. Right click on control and modify changes.
. Example: Created Button "Click Here"

. When this button is clicked, it needs to give some result.
. Example: On clicking "Click Here", it shows name of table.
. To perform this operation, we should write code as Follows:
  > Right click on Control
  > View source code
  > Edit the code in Module.
. We get the result as written in code when we click on Button.

Adding Macro to Quick Access Toolbar:

. Instead of using Shortcut keys, we can also do task by just clicking on icon.
  > Click on Customize Quick Access Toolbar.
  > Select More Commands.

   > Choose Macros.
  > Select Macro Name.
  > Click on Modify .
  > Select an icon ( Selected Tick Mark).
  > Click OK.

. Now the icon appears on the Quick Access Toolbar.   

. Whenever we click on that icon, we get the result. 

Macro for repeating a row:

. We can also use Macro for repeating a row for number of times.
. Let us consider a row is to be repeated for 5 times.
. Alt+F11, it open editor to write code.
. Now close the window and open the worksheet.
. Select the rows and run Macro.
. We get the following output: