Category Archives: Loops

How to Loop Through an Array of Values in VBA

Introduction to Arrays An array is a sequence of values in an order that can be referred with indexes where identifying the start index and the end index of the array is important. This is called the lower bound and upper bound of array. Looping

Guide: Do Until Loops in VBA

Loops in VBA Just like any other programming language, VBA also provides several loops that help with the repeated execution of a specific piece of code for a certain number of iterations based on defined conditions. The list of loops provided by VBA are:  For

For Loops in VBA and the Continue Statement

Loops in VBA Loops are an essential part of any programming language because they help with the repeated running of any code snippet. Just like any other language, VBA offers the following loops to enable efficient programming: Do until Do while For Foreach In this

No Thumbnail

If/Else Then Do Nothing in Excel VBA

When we don’t want to do anything in an If-then-else statement, believe it or not, we can simply not place any code! This is the most straightforward way to ‘do nothing’ in VBA. VBA does not have a specific statement that can be used for

The Guide to Removing Characters from Strings in VBA

String manipulation is a crucial skill in VBA programming. The skill level of a VBA developer is often determined by how well he/she can manipulate string data. Excel is very strong in mathematics operations and comes with loads of built-in calculation functions. But text manipulation

Using the VLookup Function in VBA

The VLookup function is an Excel function.  It can be used directly on your worksheet without having to use any VBA code.  However, there may be instances in VBA where you wish to also use VLookup functionality. You would then need to call the VLookup

The ReDim Statement in VBA

The ReDim statement is used to declare the size of a Dynamic array in VBA.  It can later be used to re-declare the size of the array as many times as you need.  It can only be used for Dynamic VBA Arrays (where the size

The Ultimate Guide to Looping Through Ranges in VBA

The art of Excel VBA programming is in the manipulation of properties of objects of Excel. The more skillfully you can play with these objects and properties, the more powerful the macros you can build. The number one object in Excel you have to process

A Complete Guide to Loops in VBA

When you write good VBA code, you try not to repeat yourself too often – in other words, you try not to write the same code for repetitive tasks more than once.  Looping structures are an invaluable part of VBA and you will use them