How to Write a Simple Macro in Microsoft Excel



In case your boss has asked you to work on some data which is huge in volume and requires repetitive tasks then probably there is an easy way out to save your precious time and make your boss happy. This way is called as Macro. Once your macro is built, you can use it to create readymade templates for similar kind of tasks that may come up in the future. So let’s say in the next quarter, your boss asks you to do the similar kind of analysis, surprise him by doing it in seconds. You will just have to place the data in the right fields, select the macro you already built and you have the analysis ready to share it with your boss. It makes your life easier.

Write a Simple Macro in Microsoft Excel

  • Developer Tab

Click the developer tab on the top right hand side corner in the menu bar. If it is not visible then probably you will have to follow the steps mentioned below to do the selection:-

    • If you are using the 2007 version of excel then select Microsoft office button > excel option > Popular Category > Top Option for working with Excel > Show Developer Options in ribbon
    • If you are using the 2010 version of the excel click on the file tab > click customize ribbon > Developer
  • Macro Settings

The proposed change in the settings is a temporary change only. After creating the macro, go back and restore the changes. For making the changes, click on trust center under the heading macro settings and click on the ‘enable all macros’ option

macro in MS excel

  • Be clear with the automation

Before you proceed, make sure you are clear with the idea of automation. There shall be lots of tasks in your excel sheet however all of them may not have a need for conversion into a macro. It might happen that converting a step into macro may take longer time. Avoid going forward with such macros.

  • Naming a Macro

As soon as you do so, it will ask you to name the macro. Remember to start the name for the macro with an alphabet only. Also along with naming the macro, you can denote a shortcut key to it. The next time when you want to run this macro, press the shortcut keys you assigned to the macro and it will run and compute your task

macro in MS excel

  • Store you Macro

Once you have assigned a shortcut to your macro, the next step is to choose a place where you can store it. An ideal way to store it is in the personal macro workbook. This way it would be available in any excel sheet you use. Before you save it, try giving a brief description to your macro.


  • Record the Macro

Once you are clear with the idea of building the macro and the logic behind it, click on record macro button present just below the developer’s tab. It will record all the steps you do on the excel sheet. After you have recorded all the steps that needs to be automated, click on the stop recording macro button.


Your macro is now ready