Tag Archives: Loop

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

How to Check if an Array Is Empty in VBA

When a list or collection of items that are the same data type are stored in continuous memory locations, we call it an array. Arrays are useful objects that are widely used in software development to organize data. Some real examples of where you might

Using Exit Function in VBA

To start with, make sure you have a good understanding of what a function is and how it works. You can get a great overview in my articles here: What is “You’ve Entered too Many Arguments”? How Do You Fix “Compile Error: Argument not optional”?

What is a VBA Dictionary?

A dictionary is an object in VBA (similar to a collection) that stores data like an array. It can be used to store data of any type except an array. A VBA dictionary has two parts: Key Value …where key is simply a reference to the

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 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

No Thumbnail

Word VBA, Looping Through Equations

Equations in a word document can be referenced through the OMaths collection: Sub Example1() Dim i As Integer For i = 1 To OMaths.Count     ‘your code here Next i End Sub You can reference each equation using the statement below: OMaths.Item (i) See also: Word VBA Creating