How to Create a Macro in Microsoft Excel

by:

Tech

For those of you who regularly have to do the same task in Microsoft Excel, it may be a good idea to create a macro to automate particular processes.

A macro is a process that you are able to initiate to complete common tasks that need done in Excel. To create a Macro in Excel, you need to “record” your mouse clicks and keystrokes to tell Excel how to do the repetitive task you are looking to automate. Then, you don’t need to do this process again. You can then edit and improve the macro over time if required.

Here is an example of when a macro would be useful. Maybe each month you have to create a detailed report for a fellow employee about the latest accounts. A good use of a macro would be to highlight the details of the overdue customers in red with a bold format. You can create a macro to completely automate this process making it easier for next month.

Before Recording a Macro…  

You need to take steps to enable the macros. To do this, all you need to do is to navigate to the “Macros and VBA” tools, which can be found on the Developer tab of Excel. It is hidden, so by enabling it, you will be able to proceed.

Recording Your Macro   

You will notice in the “Code” group on the Developer tab, there is a button for “Record Macro”. Once you click this, you can then perform the series of actions that you wish to create in your macro. This can be something such as filling a column with some data and formatting the text in the cells, or creating an Excel PDF. Once you have finished recording, make sure you go to the “Developer” tab and hit the “Stop Recording” button.

Refining and Editing Your Macro   

There may come a point where you may be looking to edit a macro. All you need to do to edit a macro is to navigate to the “Developer” tab, then select “Macros”, and choose the name of the macro that you wish to modify and click “Edit”. This then triggers the Visual Basic Editor for you to make the changes.

You can then see how the actions in the macro that you recorded appear as code. Don’t worry if some of the code is rather confusing. Not all of it will be bamboozling! We would recommend (if you know what you are doing) to play around with the code to try and improve the Macro further.

For other Excel Applications, check out cours-gratuit.com.

Leave a Reply

Your email address will not be published. Required fields are marked *