The Excel Visual Basic Editor is also sometimes referred to as the VBA Project window. The Visual Basic Editor (VBE) is a simple developer environment available in Excel, Access, PowerPoint, Word and all other MS Office applications. It allows you to code simple Visual Basic for Applications macros. If you are new to VBA checkout my VBA Tutorial.
Today we will learn the basics as well as some tips and tricks on how to master the VBE (Visual Basic Editor).
How to open the Visual Basic Editor?
The Developer tab in the Excel ribbon is required to work with Excel VBA. Apart from enabling you to access your VBA Project, it also contains other useful features and shortcuts which we will dive into later e.g. Macro recording, Form Controls (buttons, checkboxes etc.).
Add the Developer tab to your Excel ribbon
To open the options window go to:
Next select the Developer tab to add it to the Excel ribbon as shown below:
Click Ok. You should now see a new tab in your Excel ribbon called Developer as shown below:
Click the Visual Basic button on the Developer ribbon
Click the button as shown below:
This will open the Visual Basic editor as shown below:
The Visual Basic Editor (VBE)
The VBE Project Window
The VBE Project Windows allows you to manage your VBA Project objects such as VBA Modules, Classes and Forms.
The VBE Code Window
THe VBE Code Window allows you to edit your VBA code – by selecting a VBA Module, Classes or Form in the VBE Project Window (see above).
VBE Tips and Tricks
Now for some tips and tricks.
Tip 1: Open the VBE (Visual Basic Editor) with VBA
May sound weird but it is actually a pretty neat trick. The following VBA code snippet can be set as a Button event to open the VBA Project Window:
Application.VBE.MainWindow.Visible = True
Below a quick gallery tutorial of How to setup a button to open the VBE from an Excel Worksheet:
Tip 2: Open VBE Window on selected Macro
If opening the VBE (Visual Basic Editor) Window on the click of a Button is no specific enough.. why not a Macro that allows you to open the Visual Basic Project Window to not only open but also open the VBE on a specific Macro of your choice! The VBA code snippet below does precisely that.
The VBA code snippet will open the VBE Window on the “Test” VBA Macro:
The VBE (Visual Basic Editor) is where all the magic happens. Got any useful VBE tips or tricks of your own? Share them in the comments below!