What is VBA-Excel and For Loop
What is Visual Basic for Applications (VBA)?
Visual Basic for Applications (VBA) is an event-driven programming language implemented by Microsoft to develop Office applications. VBA helps to develop automation processes, Windows API, and user-defined functions. It also enables you to manipulate the user interface features of the host applications.
Before we go into further details, let us look at what computer programming is in a layman's language. Assume you have a maid. If you want the maid to clean the house and do the laundry. You tell her what to do using let us say English and she does the work for you. As you work with a computer, you will want to perform certain tasks. Just as you told the maid to do the house chores, you can also tell the computer to do the tasks for you.
Why VBA?
VBA enables you to use English like statements to write instructions for creating various applications. VBA is easy to learn, and it has easy to use User Interface in which you just have to drag and drop the interface controls. It also allows you to enhance Excel functionality by making it behave the way you want.
Introduction to Visual Basic for Applications
Before we can write any code, we need to know the basics first. The following basics will help you get started.
-Arithmetic operators - The rules of Brackets of Division Multiplication Addition and Subtraction (BODMAS) apply so remember to apply them when working with expressions that use multiple different arithmetic operators. Just like in excel, you can use
    + for addition
    -for subtraction
    * for multiplication
    / for division.
-Logical operators - The concept of logical operators covered in the earlier tutorials also apply when working with VBA. These include
    If statements
    OR
    AND
    TRUE
    FALSE
    NOT
    AND
VBA - Loops
There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.
Programming languages provide various control structures that allow for execution that is more paths that are complicated.
A loop statement allows us to execute a statement or group of statements multiple times. Following is the general form of a loop statement in VBA.
for loop: Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
Please Watching My Video is Below
No comments:
Post a Comment