VBA TERMINOLOGY AND BASIC PROCEDURES
Code is done in the CODING WINDOW.
As we are aware that any programming is done with the statements. Same is the case with Visual Basic, we write the code to be performed and executed.
All the code written is stored in the module.
The code is the main content which makes the program execute. The program is executed by compiling the code. If there is any error we need to revisit the code. The program can’t run if the code is having an error.
So our focus will be to do the programming correctly to get the desired result.
Modules are just like a module of the book. A collection of procedures. We store modules in the workbooks. We can always edit them by going to VISUAL BASIC EDITOR.(VBE).
This module contains all the code in the form of procedures.
We’ll see the procedures later in the same article.
ADDING A MODULE
Here are the steps to add modules into workbook.
- Select the project in which the module is to be inserted.
- Go to INSERT MENU and select insert>module.
REMOVING A MODULE
If you want to remove the module, follow the following steps:
- Select the module to be removed.
- Go to file.
- Click on Remove …. module. …… will be having the name of the module.
WHAT ARE PROCEDURES IN VBA
PROCEDURES are the codes which we do in the VBA. These are the sets of statements which are instructions for the Excel to perform.
There are mainly four types of procedures
1. SUB PROCEDURES: Set of simple instructions to be carried out in a sequence.
2. FUNCTION PROCEDURES: A function is a set of precedure which returns a single value or an array. Many functions are builtin in Excel such SUM, SUMIF, VLOOKUP, XLOOKUP etc.
3.DELARATION PROCEDURES: These are the declaration of variable. Variables are the data types of some specific type which we use for holding the values while performing the calculations.
4. PROPERTY PROCEDURES: These are used in the Class modules only.
We’ll discuss only the first three in details in the further articles.
STANDARD FORMATS OF PROCEDURES.
It starts like
statements to be executed
This was a subprocedure. As soon as we declare this, we will find the name of the subprocedure in the macro list. We can run the code from the macro. It executes the statement line wise line.
CLASS MODULE PROCEDURE
OTHER WAYS TO REACH THIS ARTICLE
WHAT IS CODE IN VBA, TYPES OF PROCEDURES, FUNCTION PROCEDURE IN VBA.
YOU MAY LIKE
- HOW TO TROUBLESHOOT A FORMULA IN EXCEL?
- USE OF FONTS, FONT SIZE, INDENTATION, TEXT TO THE RIGHT, TEXT TO THE LEFT, TEXT IN THE MIDDLE ETC.
- how to insert table in excel?
- FOR MORE ARTICLES, CLICK EXCEL OR TYPE IN SEARCH BELOW.