Posted on Leave a comment

Visual Basic Editor

Spread the love

The Visual Basic Editor is the tool used to create, modify and maintain Visual Basic for Applications procedures in Excel. The easiest way to access VBE is to press Alt + F11. When you press this combination, a VBE window will open.

VBE has a lot of options or windows that can be accessed from the View menu at the VBA editor window. Each one is explained below.

The Project window

The Project window opens on the left of the Editor window. It provides you with an index of all the VB files that are linked to open Excel workbooks. It shows you files linked to each worksheet as well as additional files (also called modules), which contain user-defined code. Modules are not specifically linked to any worksheet.

If you want a macro to be linked to a specific worksheet then you should choose the file option, but if you want your macro to be general then it will be better if you create a new module. You can create a new module by clicking on the option “Insert” and choosing the “Module” option.

The Code window

The Code window shows the VBA code for each individual worksheet or module. Once you open a module or worksheet, you can enter your code directly in the Code window and the VBA editor will help you create valid code.

The Properties window

This window lists the various properties of the object selected in the Project window. These properties may vary depending on the type of object selected. An object can be a worksheet or a workbook or a module.

The Immediate window

You can open the Immediate window either by selecting it in the View menu of the VBE or by pressing Ctrl + G. The Immediate window helps with the debugging of the code, either by acting as the output for the debug statement or by allowing the user to evaluate expression of lines of code.

The Locals window

The Locals window can be viewed by selecting it from the View menu in the VBE window. This window will display all the local variables that are declared. It is separated into columns, which show the name, value and type of variable. It also updates these values automatically as the program continues to run.

The Watch window

The Watch window can be accessed by selecting it from the View menu in the VBE window. The Watch window is useful in debugging VBA code. It shows the value, type and context of watch expressions defined by the user.

Leave a Reply