VBA Editor

Tags:

So you have recorded your first Macro in Excel VBA but most of the times you want to do something more that cannot be achieved with just recording and for customizing the Macro you need to Modify the VBA Code. VBA Editor is just for that, modifying and writing your own code.

What is VBA Editor?

VBA Editor is the Window where Code for Excel VBA is written. It is just like any other Text editor like Notepad and Wordpad. Instead of plain English the Code is written in the Language which Excel can understand. VBA Editor is also a Program to create and Edit VBA Macros. You can also call it as IDE (Integrated Development Environment)

How to Open VBA Editor

Select Tools > Macro > Visual Basic Editor Or simply press ALT + F11, it is the shortcut to open the VBA Editor.

Parts of VBA Editor

VBA Editor can be customized by the user. Many Windows can be added and removed but It is important to know the following Windows.

- Editing window: Displays VBA code for editing and User Forms for design.
- Project Explorer window: Displays the loaded VBA projects and the components of each project.
- Properties window: Used to view and edit the properties of the current object.
- Immediate window: Displays the output of debugging statements in your code.

Create a new Module

Steps to create a new Module.

1. Open the Excel Worksheet where you want to create a Macro.
2. Press ALT + F11 to open the VBA Editor
3. In the Project Explorer Window right click on the VBAProject(Excel Sheet Name) > Insert Module
4. By Default a Module with the name "Module1" will be created under a Folder Modules.

Edit existing Module

Steps to edit any existing Module.

1. In the Project Explorer Window > Click on the small plus sign in front of VBAProject (Excel Sheet Name).
2. Sub Folders will be expanded
3. Go to Modules Sub Folder > Double Click on the Module you want to edit
4. A new window containing the content of the Module will be opened. Do the necessary modification > Save the Module and Close the Window.
5. Now you have just edited the Module!