Macros in Excel

Macros are set of instructions that are written into an Excel VBA (Visual Basic For Application).

With the help of Macros, you can record and automate the tasks in Excel.

Macros are the most powerful features in Excel.

If you run recorded macros it will automate the recorded tasks. macros save a lot of time in routine works.

In this tutorial, you are going to learn how to enable and create a simple macro with an example.

Enable Macros in Excel

To record macros in Excel first, you need to enable the Developer option in Excel Ribbon.

Developer Tab

To enable the Developer Tab, follow the below steps.

1. In Windows Go to File -->Options-->Customize Ribbon--> then check the Developer Check box.

2. In Mac Go to Excel-->Preferences-->Ribbon & Toolbar--> then check the Developer Check box.

Developer Tab

3. In the Developer Tab you will get the Record Macro option.

Enable Macros in Excel

4. One more method to use Macros in Excel is, you can use direct record macro shortcut at the bottom of the excel sheet.

Record macro

Create a Macros in Excel

Using any one of the above methods you can start recording a macro in Excel.

In this example, I want to record copy and paste macro. for this

1. Click on the record macro button (Check Relative References).

2. Give a name to macro..here I will give the name copypaste.

Macro Name

3. Select the range of cells to copy (A1:B5).

4. And paste copied cells into other columns (D1:E5).

5. Click on the Stop Recording button.

After completing a macro recording you can assign macro to the command button which is available in the Developer Tab.

Command Button

In this above example, I have recorded a copy and paste task in Macros and also assigned to button.

If somebody clicks on that button the same copy and paste task will execute automatically.

Excel Macro Result

Delete Macro

To delete recorded macro execute the below steps.

1. Go to View Tab-->Click on View Macros.

2. Select the macro you want to delete.

3. Click on Delete Macro Button and give Ok.

Delete Macro

Note:- While Saving the workbook you should select the Macro-Enabled workbook(.xlsm) format only.

Macro Enabled Workbook

Download


Get Your FREE Excel Shortcut Keys e-BOOK