Posted on Leave a comment

Excel Macro VBA. How to create a macro!

Spread the love

Excel Macro VBA. How to create a macro.

What is a Excel VBA Macro?

A macro is a tool in Microsoft Excel that allows you to perform a number of operations just by opening a workbook, clicking a button or changing a cell value. A macro is basically a recording of a series of tasks in Excel. It increases the efficiency of Excel by reducing manual work and saving time.

In Excel, you have the option to record or write a macro.

How to record a excel VBA macro

You can record a macro by following these steps:

  1. Open a new workbook.
  2. Go the “Developer” tab and click on the “Record Macro” button that is found in the Menu bar.
  3. In the Record Macro dialog box that opens, enter the name for this macro. You can also add a shortcut for this particular macro so that it will run when you press the shortcut.
  4. You can also enter the location where you want to store the macro.
  5. Then click OK and perform some operations and functions on the worksheet.
  6. After you are done, click on the “Stop” button, which will be in the same place where you clicked “Record Macro”.

To view this macro, right click on the sheet name and select View Code. In the pane, under VBA Project, expand the Module and you will see all the recorded macros for this worksheet with their respective names.

How to run a macro

There are two ways to run a recorded macro in Excel. The first method is by pressing the Run button and the other is by pressing Alt + F8.

When you click on the Run button or press Alt + F8, a dialog box will open. In this box you have to choose the relevant macro, select it and click Run. Then the recorded macro will play. Once the macro finishes running, you will see that any formatting that was deleted after the recording will be redone.

Leave a Reply