spot_img

VBA Editor

The first step to working with VBA in excel is familiarized with the Visual Basic Editor also called the VBA Editor, VB Editor or VBE Editor.

Visual Basic Editor is a separate application. It is a part of Excel and opens whenever you open an Excel workbook. By default, it’s hidden, and you have to activate to access it.

Visual Basic for Applications Editor is a very powerful tool. It is an interface for creating scripts.

VBA Editor is the place where you keep the VBA code.

There are multiple ways to get the code in the VBA Editor, such as:

  1. When you record a Macro, it creates a new module in the VBA Editor automatically and inserts the code in that module.
  2. You can manually write VBA code in VBA Editor.
  3. Also, you can copy a code from some other workbook or some other source such as the internet and paste it in the VBA Editor.

Access the VBA Editor

There are various ways to access or open the Visual Basic Editor in VBA, such as:

  1. Using a keyboard shortcut (Easiest and Fastest).
  2. Using the Worksheet tab.
  3. Using the Developer tab.

1. Using a Keyboard Shortcut

Let’s see how to access the VBA Editor using a keyboard shortcut such as:

This is the easiest way to access the VBA Editor to use the keyboard shortcut, i.e. hold the Alt key and press the F11 key (Alt + F11).

It opens a separate window for the Visual Basic for Application Editor.

This shortcut works as a toggle. Therefore when you use it again, it will take you back to the Excel application.

NOTE: For the Mac version the shortcut key is Opt + F11 or Fn + Opt + F11.

2. Using the Worksheet Tab

Let’s see how to access the VBA Editor using the worksheet tab step by step, such as:

This is the less used method to open the Visual Basic for Application Editor.

Step 1: Go to the Worksheet tab.

Step 2: Right-click on the tab.

Step 3: Then, select the View Code option.

Access a VBA Editor

Step 4: It will open the VBA Editor and also open the code window to that worksheet object.

Access a VBA Editor

This is very useful when you want to write code works only for a specific worksheet. This is usually happening with worksheet events.

3. Using the Developer Tab

Let’s see how to access a VBA editor step by step, such as:

Step 1: First go to Excel window.

Step 2: Click on the Options button.

Access a VBA Editor

Step 3: Click on the Customize Ribbon button.

Step 4: Select the Developer checkbox, as shown in the below screenshot.

Step 5: Then click on the OK button.

Access a VBA Editor

Step 6: Now, you will be able to see the Developer tab in the Ribbon.

Access a VBA Editor

Step 7: Select the Visual Basic option or press Alt+F11 shortcut key.

Step 8: It will open a VBA window shown in the below screenshot.

Access a VBA Editor


Next TopicWhat is Macros

spot_img
Previous articleVBA Data Types
Next articleCircular reference in Excel