Excel VBA Editor
VBA Editor is the platform to write and edit the VBA code. By default, it is hidden. To use it, we need to activate it. Visual Basic Editor (VBE) is a separate application for Microsoft products like Excel, Word, and PowerPoint.
Table of contents
How to Open Visual Basic Editor?
We can open VBE using three different ways.
#1 – Using Developer Tab
To open the Editor, we must go to the Developer tab of excelDeveloper Tab Of ExcelEnabling the developer tab in excel can help the user perform various functions for VBA, Macros and Add-ins like importing and exporting XML, designing forms, etc. This tab is disabled by default on excel; thus, the user needs to enable it first from the options menu. and click on the “Visual Basic” option, as shown in the picture below.
#2 – Using Worksheet Tab
We can also open the Editor by using the Worksheet tabWorksheet TabWorksheet tabs in excel are rectangular tabs visible on the bottom left of the excel workbook. The active tab shows the active worksheet available to edit. There can be three worksheet tabs opened by default, and we can insert more tabs using the plus button. as well. To open this in the worksheet tab, right-click on select View Code.
#3 – Using Shortcut Key
Of all the three ways, this is the favorite. We do not use the other two methods at all. press, the shortcut excels keyPress, The Shortcut Excels KeyAn Excel shortcut is a technique of performing a manual task in a quicker way. ALT + F11 To open the Editor window.
It is a toggle shortcut when you press it. If you press it again, it will take you back to the active workbook.
Visual Basic Editor Window
If you look at the VBA window for the first time, it does not look very comforting because of a completely new option and features you see for the first time. When you look at the window, it has a retro look. Even though various new designs replaced the Excel visibility, Visual Basic Editor still has its retro look from the beginning.
We usually see four parts in the Visual Basic Editor window. Below is a detailed explanation of the same.
- Menu Bar: Like Excel has a menu ribbon; similarly, Visual Basic Editor has its menu bar. It has all the available things in VBA. You can do settings, insert modules, toolbars, etc.
- Tool Bar: In the toolbar section, we can save, head back to the Excel worksheet, we can redoWe Can RedoIn Excel, we have an option named “Undo” that we may use by pressing Ctrl + Z. When we undo an action but subsequently realize it was not a mistake, we can cancel the undo action and return to the original point, using "Redo.", undo, run the macro, stop the macro, etc.
- Project Window: It is always on the left side of the Editor. It has a workbook name, worksheet name, and modules.
- Properties Window: Properties window is associated with the Project window. Here, we can change the sheet name, module name, etc. Suppose you do not see this window by default; press F4 to activate it.
It is a floating window. We can move anywhere within the window. Using this window, we can change the selected object’s properties.
How to use VBA Editor?
Example #1 – Adding Modules in Editor
We write all the macro codes inside the module. By default, you do not get to see the module. So first, we need to insert the module.
Go to Insert > Module.
As soon as you click on “Module,” you can see the newly created module under the worksheet project tool.
As soon as you insert the module, you can see the white blank window on the right-hand side, called the “Code” window. In this window, we write all the codes.
It is the basic and much-needed introduction to the Visual Basic Editor (VBE).
Note: If you do not see all the options at first go, there is nothing to panic about here because you can enable and disable it at any time under the “View” menu.
Example #2 – Working with Properties Window
One simple introduction you need here is how to work with the “Properties” window. Using this window, we can change the properties of the objects here.
For example, if you want to change the worksheet’s name, you can change it here.
Similarly, you can change the module name as well.
It is the general overview of the Visual Basic Editor window. The more you use it, you will slowly get to know the window.
This article has been a guide for the VBA Editor. Here, we learn how to open the Excel VBA Editor and use it, including the menu bar, toolbar, project, and properties window with descriptions. You may learn more about Excel VBA from the following articles: –