What is VBA
Microsoft Office documents (Excel, Word etc) are shipped with extensive functionality which is more than enough for most users. But there may be a need for enhancement to these applications or automate certain tasks that standard versions of these software are not equipped with. For this purpose, Microsoft applications include a programming environment to add new functions to standard application.
Visual Basic for Applications is programming language based on Visual Basic Programming language to enable advanced users to enhance standard applications (such as Word, Excel).
Getting started with VBA Editor
You can use Alt+F11 to open and access VBA editor.
You can add, delete and move windows. When you open, you should see Project window in top left frame. Project window lists areas where you can write code. In bottom left corner, you should see property window. This window shows properties of selected object. You can change properties to control object. Right window is the main window and is used to write code. Main window will be grey initially; it will turn white and editable when you insert some code. You can add more windows as required by going to Menu ->View.
Macros – Macros are used to automate tasks.
User Defined Functions – Excel comes with huge number of functions to use. You can add more functions by writing code in VBA.
Module – Module is a placeholder for VBA code and can be used to group functions and procedures.
Procedure – Procedure is a piece of VBA code to perform a specific task.