Macros in Excel: What they are and how to create a Macro

Macros in Excel: What they are and how to create a Macro

Macros in Excel: What they are and how to create a Macro

When we have to create a spreadsheet, keep an accounting or create a calendar or an invoice, the most complete application, known and used for this purpose, is Excel . This office application is part of the Microsoft Office suite and has everything you need to make creating these spreadsheets as easy as possible. However, while we are working with them, we may find that some tasks can be really repetitive, tasks that if they could be automated would be very useful to us, and this is where Macros come into play .

Macro is a small program, a set of instructions, that can be configured in certain office applications, such as Word or Excel , and whose main purpose is to automate certain routine and repetitive activities, as well as being able to give documents a complexity that, otherwise it would not be possible.

Some of the most common Excel macros are, for example, giving the same format to a specific sheet or creating the same table. Other more common uses of these instructions may be, for example, to insert certain content between certain rows or organize some content.

The Excel Macros the truth is that they can be complicated for users without too much knowledge. Anyway, in the end it all depends on what we want to complicate ourselves. Next we are going to explain how to create a simple Macro in Excel.


Also Read : 5 Free alternatives to Microsoft Excel


How to create Macros in Excel

As the Macro are a function focused mainly on advanced users, the tab that allows us to access these functions is hidden by default, so in order to use these functions what we must do is enable this tab. To do this, we must enter the section File> Options and, in the section ” Customize the ribbon ” we will activate the “Developer” box.

How to create Macros in Excel

Now we can see how a new tab called «Developer» has appeared in the toolbar

Macro Developer


How to record a new Macro in Excel

To record a new Macro in Excel what we must do is, from this new «Developer» tab , click on the “Record Macro” button that appears on the left side of the Ribbon list.

How to record a new Macro in Excel

By clicking on this button, a window will appear from which we can configure the Macro that we are going to create. From this window we can give it a name, assign it a keyboard shortcut and even choose whether we want it to be part of a book, or group of macros.

Record Macro

At this time the Macro will start recording. Now we must carry out all the tasks that we want to automate in this script so that Excel saves them step by step. Once we have done what we wanted to do, we will only have to stop recording the Macro to save it.


How to view the saved Macro and how to run a Macro in Excel

To see all the Macros that we have created and saved in Excel, what we must do is, within the Developer tab, click on the «Macros» button .

We can see a window like the following where we will see a list with all these automatic tasks saved.

How to view the saved Macro and how to run a Macro in Excel

When we select a Macro, a series of buttons will appear on the right. The first of them is called «Run», and it will allow us to launch the Macro to carry out its activity. In addition to this button we also have others such as « Step by step «, which allows us to execute the macro function by function, very useful if, for example, to detect the exact point where there is a problem or a certain event occurs, and, in addition , the “Edit” button that will allow us to open the code editor to analyze the functions of the Macro and modify or program it by hand.

 open the code editor

 

Do you often work with Macros? What tasks do you usually automate the most?

 

Also Read : Google Sheets are not Excel.Here are 5 tricks you didn’t know about