Skip to content
Step by Step Internet 馃寪 Guides for learning to surf the Net

How to create and record a macro in Microsoft Excel? step by step guide

UPDATED ✅ Do you want to know how to create a Macro to automate different tasks in Microsoft Excel? ⭐ ENTER HERE ⭐ and learn everything FROM ZERO!

When working on this kind of software it is very common to carry out repetitive tasks, that is, they must constantly enter the same commands to perform some functions. Therefore, make use of macro is essential for save time when working on them.

This tool known as macro is nothing more than a series of instructions They are responsible for registering and saving a script so that they can be executed automatically by the user at certain times. In this way, this type of element becomes of great help since it allows save time when working on these programs.

In the case of Microsoft software has the ability to create and record simple macros at any time. That is why here we are going to explain a little more about what this function, its main benefits and how you can easily start recording them. To do this, follow in detail everything that we will teach you below.

What is a Macro and what are they for in Microsoft Excel?

It is no secret to anyone that Microsoft Excel is one of the programs most used database in the worldthis is because it offers a great variety of functions that allow to carry out tasks in a very simple and very professional way. This is how all users have the possibilities of create and record macros to further facilitate your work on it.



It’s like this Excel function uses the Visual Basic For Applications (VBA) scripting language, which is also used by the other programs of the office office suite as they are Word, Access and PowerPoint. This language allows you to create macro so they can be executed automatically at any time.

All this has made it possible for users to record commands that are used frequently or even add new functions to the spreadsheet. In this way, it can be said that the main function of this tool is to allow automate repetitive tasksthus preventing users from having to repeat instructions or steps over and over again.

when working on Excel It is very common that at times you have to perform tasks over and over again, so this function becomes very useful. But, this is not the only function that match the macrosthey also allow you to create your own functions, as well as create complete programmed applications, forms, interact with other programs, among many other activities.

Finally, it should be mentioned that this tool allows you to automatically record all the instructions you think necessary easilyso you won’t have to be a programming expert to pull this off. Being able to use this functionality of Excel undoubtedly It will make your job easier and save you the time you spend on it..

What are the benefits of using macros in Excel spreadsheets?

When using such a tool in a calculation program such as Excel, is because it offers a Lots of benefits for users.

This means that if you want to get the most out of this type of software you’re going to have to start use macroswhich are going to become the right hand of each of your tasks in the program.

According to this, here we show you the main benefits that all this offers you:

It allows you to reduce the error rate

One of the most important benefits What this offers you is that it helps you eliminate the error rate in the program. Note that every time you enter a command manually in the spreadsheet increases the chance that you can make a mistake when writing itespecially when dealing with complex sequences.

This means that if you type the same command 10 times or more it is quite possible that in some of them end up making a mistake. It is because of that recording macros will help you eliminate all this riskas the only possible error that can occur here is that the person makes a mistake when creating it.

This means that if you create it correctly all it will work great, which will remove any risk of mistake.

Allows you to reduce work time

It is no secret to anyone that you are going to save work time if you can add certain tasks automatically instead of having to enter them manually.

Note that macros are created once and can be used whenever you need them. All this will allow you save time on each of your Excel jobs.

Helps you increase the usefulness of Excel

One of the main advantages of this program is that it allows you program macros and develop new functions. This allows users to have the possibility to expand functions within the program.

In this way users can work more comfortably in Excel, either by pinning quick access buttons to your own macros in the symbol bar.

Steps to create and record a macro to automate tasks in Excel

taking into account all the benefits this offersthe next thing will be to explain how you can start creating and recording a macro to automate each of your tasks in the program. Keep in mind that to create it you must activate the Visual Basic editorwhich it is part of the developer tools and is not enabled by default.

Therefore, to carry out this procedure it is necessary that you carry out each of the steps that we will teach you below:

Adds the Developer tab to the ribbon

  • To do this, go to the tab “File, Archive” and in the options menu that appears on the screen, select “Options”.
  • Now select “Customize the Ribbon” in which there is a list of all the main tabs, there you can see Developer (Developer or programmer).
  • Here you must check the box and click on “To accept”.

Adds the Developer tab to the ribbon

  • The next thing will be to see the ribbon in the tab of “Programmer”, there you should see the option Macro and Visual Basic.

Adds the Developer tab to the ribbon

Create a workbook for your new macros

Once this is done, the following will be create a workbook to serve as the basis for your macros registered.

To do this you must perform these steps:

  • Here you must do click in macro located in the tab “Programmer”, there will appear a pop-up window where you must enter the name of the macro you want to create. Note that here you can put the name you want.
  • One time defined the nameyou must click on “To create”.

Adds the Developer tab to the ribbon

  • Then the window will open VisualBasic.

Adds the Developer tab to the ribbon

  • “Sub” is equivalent in this case to subroutineso it refers to a macro. When you start a macro executes the code between Sub and End Sub. To run a test of this you can run a test typing the macro name What “World command!”.

Adds the Developer tab to the ribbon

  • The code is saved in .xslm format and the window closes to return to the excel spreadsheet.
  • Now again you must click on “Macro” and there select the macro you have created.
  • To be able to execute it, you must click on the button “Run”.



Adds the Developer tab to the ribbon

  • a will appear small information box with the text that appears in the image and click on “To accept” for the window to close.

Adds the Developer tab to the ribbon

  • Finally I know will save the workbook in Visual Basic.

Create a quick access button for macros

When you have completed the previous steps, the next thing will be create quick access button. Note that macros are accessible for execution either from the tab “Programming” as from View.

However, if you have created a macro that you should use very often then the best thing is that create a shortcut in the list of shortcut symbols.

To do this you must follow each of these steps:

  • enter to the tab of “File, Archive”.
  • there you must select again the item “Options”.
  • The next thing is to click on the list of quick access symbols.
  • now you must select command from the option “Macro” and there he looks the name of the macro that you created earlier.
  • Here you must add it to the list of quick access symbols selecting it and clicking “Add”.
  • before selecting “To accept” to confirm this whole procedure, you can also determine the symbol with which it will be displayed. To do this, select the macro name that you created and click on “Change”, Here select the one you like best.
  • When you have finished all this, click on “To accept” so that save the changes.

Create a quick access button for macros

record the macro

now in the visual basic editor which is included in Microsoft applicationsit allows you create macros without much experience in it. This way it will create a macro that automatically renames a sheet.

To do this you must perform each of the steps that we will teach you below:

  • For this you must get into to the tab of “Programming” and there select the option “Record macro”.

record the macro

  • In the dialog box that appears on the screen you must enter the following name “Rename worksheets” and start recording clicking on “To accept”.

record the macro

  • Now rename the sheet1 by “New name” and ends the recording of the macro by clicking on “Stop recording”.

record the macro

  • The next thing is to go back to “Visual Basic Editor”, To do this, follow this route: “Macro”>”Edit”>”Edit”. Here you will be shown the following:

record the macro

record the macro

when you have joined back to “Visual Basic Editor” you will see the first four lines of code under the line that starts with Subwhich begins with an apostrophe, this constitutes comments that have no influence on the overall functionality of the macro. This means that they only serve to have a better code compression.

All these comments allow temporarily disable some of the lines of code. Please note that you are lines are not necessary for what they can delete without causing any problems.

The lines below contain the Select method to select “sheet 1” a step that takes place during the manual execution of the name change. But in this case Visual Basic scripts do not need to solve objects to be able to edit them, so these lines of codes are expendable. In this way, in order to Finish your edit, the final code should look like this.

record the macro

finally you must go back to Excelhere you need to change the worksheet name to sheet 1 so that the macro can be run as a test “Rename worksheets” that was created earlier.

In this way the name must be switch automaticallykeep in mind that in order to set the macro again you have to set the macro to the new name.

Computing