Visual Basic Editor Tutorial In Excel

On this page I present the Visual Basic Editor – an environment where you can edit recorded macros and write new macros and programs in Visual Basic for Applications. This is practically relevant workshop in which you write code programs. 

To run the Visual Basic Editor, you can use several ways:

  • The Excel Ribbon, choose Developer and Visual Basic;
  • Being in the Excel spreadsheet you can use Alt + F11 keyboard shortcut;
  • In the figure below we present the editor of several spaced windows – I describe them further down the page.

Excel Visual Basic

To close the Visual Basic Editor can also be used several ways:

  • From the File menu, click Close and Return to Microsoft Excel;
  • You can use Alt + Q keyboard shortcut;
  • You can close the editor as we close every window.

Project Window:

Window Project (Project Explorer) look and feel like Windows Explorer. Displays a hierarchical list of all elements of the project, the window is used to move between elements of the project. To open the Visual Basic Editor Project window

  • From the View menu, choose the option Project Explorer;
  • You can use Ctrl + R keyboard shortcut;
  • Click Project Explorer on the toolbar (standard).

Excel Project VBAProject

The upper part of the window contains three buttons:

  • View Code – opens the code module in the selected object;
  • View Object – we can use this button to open a selected object in the window, for example, form or return to the Excel spreadsheet if it is selected (as shown above);
  • Toggle Folders – Folders hides or shows objects being constantly visible are contained in these individual elements. If we remove the folders, objects are displayed in alphabetical order.

Properties Window:

Window Properties (Properties) – displays properties that describe the selected (active) object, of course, the values of these properties can be changed in this way modifying the selected object. To the editor to display the Properties window:

  • Press the F4 key;
  • From the View menu, select Properties Window option;
  • Click the Properties Window button on the toolbar (standard).

Excel Properties Sheet1

In the upper part of the window’s drop-down list. This list gives the opportunity to select an object (by clicking on the arrow), whose properties you want to view. Here are two cards of the properties by which you can view the object properties alphabetically or by category. The left column of each of the cards (as viewed from the user) is a set of parameters specifying the names of your element, while the right side is the size and characteristics of these parameters.

Code Window:

Code window (Code program) – is used to write code in Visual Basic, as well as for viewing and editing program. This window is probably the most often used by us. You can open as many windows as a program code to the modules. To the editor, open the code window, in the Project window, double-click the left mouse button the object. Another way is to select the corresponding object in the Project window and then:

  • From the menu select View Code;
  • Press the F7 key;
  • Click the View Code icon in the Project window;
  • Click the object, right-click context menu and select View Code.

Excel Microsoft Visual Basic for Applications Code

In the upper part of the window we can distinguish two components:

  • Field (drop down) Object – is on the left (as viewed from the user) and the window shows a list (by clicking on the arrow) related objects. If the drop – down list select the name of the object Object, the VBA procedure creates a default template for this object;
  • Field (drop down) Procedure – the right of the window shows a list of possible events associated with the selected object in the Object.

It should be mentioned are the two buttons located at the bottom left of the window. Procedure View button that displays only the chosen procedure. The second button displays the Full Module View all of the code module.

Between the windows described above, we can provide some dependencies:

  • If you change the selection in the Project window, the Properties window, change will be similar;
  • When in the Project window, double-clicked the left mouse button on the specified object, open the Code window (module code) of the object;
  • When you have several windows open code, when switching from one window to another similar code change will occur in the Project Window and in the Properties window.

Template

You can download the Template here – Download
Previous articleHow To Link Objects In Excel
Next articleGoogle Classroom Tutorial