×

Introduction to Visual Basic Editor Window

How to enable the Developer Ribbon Tab?

In order to work with VBA, users need to make a small change in Excel to display a new tab (Developer) at the top of the screen. Microsoft Excel does not display the Developer ribbon tab by default. So, getting Excel to display the developer tab, follow these steps.

Method 1

  • File -> Options -> Excel Options -> Customize Ribbon -> Check Developer -> Click OK
Introduction to Visual Basic Editor Window

OR

Method 2

  • Click anywhere on the Ribbon and choose to Customize the Ribbon
  • Look at the right side of the Customize the Ribbon dialog box
  • Checkmark next to Developer
  • Click OK

Developer Ribbon Tab

The Developer tab contains the most powerful tools in Excel that allow you to create and access macros, to develop and customize Excel. Developer Ribbon Tab has further three sections which are explained below:

  1. Code: This section is used to open VBA Editor, view, record, and manage your macro security option.
  2. Add-ins: This option allows the user to manage the Add-ins, Excel Add-ins and COM Add-ins
  3. Controls: This section enables the user to view the VBA code, set properties, activate the form, and insert ActiveX controls.
  4. XML: This option manages the importing/ exporting Data and XML extension packs options.
Introduction to Visual Basic Editor Window 1

What is Visual Basic Editor?

Visual Basic Editor (VBE) is an environment which is used to write the VBA codes. You can’t run VBE separately, and Excel must be open for VBE to run. It is used to create, modify, debug, and maintain the VBA (Visual Basic for Applications) procedures, codes, and modules in Excel. The Visual Basic Editor (VBE) is contained in the Microsoft Excel workbook.

Introduction to Visual Basic Editor Window 2

How to activate VBE ?

There are two procedures to activate the Visual Basic Editor window in Excel.

Option 1

Press ALT + F11

Option 2

Choose Developer -> Code Visual Basic

Components of VBE

The components of the VBE are as follows:

Menu Bar: VBE has a Menu Bar which has menus like File, Edit, View, Insert, … and other Toolbars, like Standard, Debug, Edit & UserForm Toolbars where you can add Commands like Save, Print, Delete, Undo, Redo,

Code Window: This is the area in VBE in which you write the codes and records the macros. On the top right is the Procedure list with which you can quickly move to another procedure in the active module. At the bottom of the code window, you can adjust between the Procedure view, which displays a single procedure in the active module, and the Full Module view, which is the default view and displays all procedures in the active module.

Project Explorer: It displays the list of all existing projects. It represents the modules and sheets in a hierarchical view wherein you can fail to hide or expand to view the objects, user forms, and modules included in a project. The project contains Object Folders, Forms folder, Modules Folder, and Class Folder. The object folder is the default folder and consists of a sheet object and This workbook object within it.

Properties Window: This window in VBE presents a list of properties for the selected object or variables, which can be modified here. To display the Properties Window, click on View in the Menu Bar -> select Properties Window or press the F4 button. It is used to edit the User-Form properties, controls properties, unlike TextBox, ComboBox, CommandButton, etc.

Procedure Box: Procedure box contains a list of the existing individual macros or procedures within the active module under the 'Declarations' heading.

Object Box: Object box displays 'General', which is the default object. It is used to select an object to work unlike worksheet, workbook, user form, checkbox etc.,

The Immediate Window: The Immediate Window facilitates debugging the VBA code and allows the user to check the output of an individual line of code. Hence, it provides an ease to rectify if there is an error in the code. You can type the code and then press enter to execute, which enables immediate execution of the method or procedure. To show the Immediate Window, click on View in the VBE Menu Bar and select Immediate Window, or press the shortcut keys, CTRL+G.

Introduction to Visual Basic Editor Window 3

The Locals Window: This window displays the name, value and type for all declared variables in the current procedure automatically and updates the variables' values while the code is executed and hence, is used in VBE as a debugging tool. To view the Locals Window, click on View in the VBE Menu Bar and then select Locals Window.

The Watch Window:  The Watch Window helps you to view and monitor the current value of a variable or expression, whose name, amount, type, and context are to be displayed in the Window. You need to explicitly add a variable or expression to the Watch window which you want to monitor, unlike in the Locals Window, where all the expressions and variables are displayed automatically in the current procedure. To add the variable or expression to the Watch window, select it and right-click and then click Add Watch, or select it and click Add Watch or Quick Watch on the Debug menu, or press the shortcut keys Shift+F9. To display the Watch Window, click on View in the VBE Menu Bar and then select Watch Window.

The VBE Environment

Visual basic environment or VBE is an Integrated Development Environment (IDE) developed by Microsoft. It uses a Graphical user interface with a basic programming language and is the first software to provide a graphical programming environment for developing a user interface module or applications.

In VBE, a considerable volume of code gets swapped by the controls, where the user must drag and drop to add any control in the interface. This environment does not have any object-oriented programming language concept.

Various attributes and event handling are coupled with the controls and default values are assigned to the controls when it is created, and it is possible to change the default values. This environment primarily allows to create a windows application, additionally create executable (exe) files, ActiveX controls, and DLL files.


Related Topics

For Next loop in VBA

For Next Loop The ”For Next” loop is used for a fixed number of times. It works by implementing the loop for the specified number of times. In this, the user specifies how...

3 minutes read.

Basics of Userform

A User Form is a built-in customized dialog box that fetches data from the user through a user-friendly dialog box or window that makes up part of an application's user interface. It...

9 minutes read.

Excel VBA Len Function

VBA Len Function: The Len function in VBA returns the number of characters in a supplied string or the number of bytes required to store a supplied variable. Syntax Len (Expression) Parameter Expression (required)-...

1 minute read.

Excel VBA LCase Function

VBA LCase Function: The LCase function in VBA converts the given String into lower case text. Syntax LCase (String) Parameter String (required)- This parameter represents the text string that you want to convert to...

1 minute read.

Excel VBA Space Function

VBA Space Function: The Space function in VBA creates a String consisting of a specified number of spaces. Syntax Space (Number) Parameter Number (required) - This parameter represents the number of spaces. Return This function returns a...

1 minute read.

Steps to Create a Pivot Table

Steps to Create a Pivot Table: Pivot Tables can be easily automated through VBA coding. To create a Pivot Table in VBA, follow the below step by step procedure to...

4 minutes read.

Excel VBA Conditional Statement

Conditional Statement in VBA Excel Conditional Statements in Excel VBA are one of the most powerful and useful features in programming, this will give you to perform comparisons to decide or...

2 minutes read.

Excel VBA IsError Function

VBA IsError Function: The IsError function in VBA returns a Boolean value showing whether the specified Expression represents an error or not. Syntax IsError (Expression) Parameter Expression (required)- This parameter represents the variant that you...

1 minute read.

Excel VBA TimeValue Function

Excel VBA TimeValue Function: The TimeValue function in VBA returns a Time from the specified String interpretation of a time /date where the date information for the given string is...

1 minute read.

Excel VBA CSng Function

VBA CSng Function: The CSng function in VBA converts the supplied expression into a single-precision floating-point number (single data type). Syntax CSng (Expression) Parameter Expression (required) – This parameter represents the expression that you want...

1 minute read.

Excel VBA DateAdd Function

The DateAdd function in VBA adds a time interval to a supplied date and/or time and returns the resultant date/time. Syntax Dateadd (Interval, Number, Date) Parameter Interval (required) – This parameter a string specifying the interval to be...

1 minute read.

Excel VBA Cos Function

VBA Cos Function: The Cos function in VBA returns the cosine value for a supplied angle. Syntax Cos (Number) Parameter Number (required) –This parameter represents the number that you want the absolute value of. Return This function...

1 minute read.

Excel VBA Time Function

Excel VBA Time Function: The Time function in VBA returns the current time. Syntax Time () Parameter NA Return This function returns the current time.  Example 1 Sub TimeFunction_Example1() ' returns the current time Dim time_val...

1 minute read.

Excel VBA LTrim Function

VBA LTrim Function: The LTrim function in VBA removes the leading spaces from a supplied text string. Syntax LTrim (String) Parameter String (required) - This parameter represents he text string that you want to remove...

1 minute read.

Excel VBA Tutorial

What is VBA? Introduction to Excel VBA: Visual Basic for Applications (VBA) is a programming language developed by Microsoft to automate operations in applications, such as Excel, Word, PowerPoint, etc. It...

5 minutes read.

How to save Macro Workbook?

Saving Macro Workbook Default Excel File Extension The default excel file extension is “.xlsx”. But the standard file extension “.xlsx” cannot contains macros. So, the workbook contains macro when save din.xlsx file, all VBA...

1 minute read.

Excel VBA Tan Function

VBA Tan Function: The Tan function in VBA returns the tangent for the specified angle in radians. Syntax Tan (Number) Parameter Number (required) – This parameter represents the angle supplied in radiant that you want...

1 minute read.

VBA VBScript Regex Methods Regex

VBA VBScript Regex Methods Regex The VBA Regex supports 3 methods which are as follows: ExecuteReplaceText Execute The execute method is used to extract a match from the given based on the defined matching...

3 minutes read.

Excel VBA AutoFilter

One of the reasons for Excel VBA’s popularity is its capability to filter and analyze data from huge database with the help of a method known as AutoFilter. This method permits a...

4 minutes read.

CodeIgniter Architecture

Here we will understand the architecture and working of the CodeIgniter application, which helps you to elaborate all steps in simple ways. As the above image represents that whenever a request comes from the...

2 minutes read.