In this tutorial you will learn the simplest and easiest way to get started with VBA. VBA Stands for Visual Basic for Applications. VBA is an event driven programming language. It is introduced by Microsoft. We can write codes and develop MS Office applications using VBA in MS Excel, MS Word, MS Access and MS PowerPoint.
We use Excel VBA to automate repetitive tasks, to build very powerful tools, to create reports, add-ins, and many more. We can interact with the user by creating Userforms, or custom dialog boxes. We have great feature in VBA is Record macro. It helps to create VBA macro code for which we perform actions in Excel. Once we create macro we can edit the code and we can customize as required.
Table of Contents:
- Excel VBA Overview
- VBA Editor
- Project explorer window
- Properties window
- Immediate window
- Object Browser window
- Code window
Open Excel Workbook, press’Alt + F11′. Now you can see VBA Window on the screen. In VBA We can see multiple windows. Those are Properties window, Project explorer window, Object browser, Immediate window and code window.
Here is the screenshot of the VBA editor window.
The Project explorer window displays a list of the projects related to each object. It has hierarchical structure. High level has toggle folder button. We can see folder and sub folder by clicking on toggle folder button. Shortcut to view this window is ‘Ctrl + R’.
The Properties window contains a list of the properties to the selected control or object. The properties window has two columns. Left side we can select the property. And right side we can the property value or assign value. Shortcut to view this window is ‘F4’.
The Immediate window displays information after executing statement or while debugging code. Shortcut to view this window is ‘Ctrl + G’.
The object browser displays all available objects and its properties, methods and events. Shortcut to view this window is ‘F2’.
The code window is used to write, edit and display VBA code or macro. This window contains more than one procedure or function. Shortcut to view this window is ‘F7’.
In this chapter we learnt about overview of Excel VBA and how to start with VBA. In the next chapter we will learn how to record a macro, how to assign a macro to a button, how to edit a macro, how to run a macro, how to run a macro and how to delete a macro.