Category Archives: Arrays

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

How Do You Redim a Multidimensional Array?

Arrays are simply a collection of values or items that are stored in continuous memory locations. They’re a data structure in which a group of items stored with the same data type. This type of structure is highly useful in the programming world as it

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

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

Subscript Out of Range: How Do You Fix It?

When running a VBA procedure, you might receive this error message “Run-time error ‘9’, Subscript out of range”. In this article, we will talk about the possible reasons for the occurrence of this error and the ways to fix it.  According to our recent review,

Ubound example

The VBA Ubound function

Description The VBA UBound (Upper Bound) function returns the upper limit of an array as opposed to the LBound (Lower Bound) that returns the lower limit of an array. Both functions (UBound and LBound) can be combined to determine the size of an array and

No Thumbnail

Excel VBA, Arrays and Ranges

When modifying worksheets and ranges,  one option would be to modify the worksheet directly using the commands I’v explained in the article Referencing Ranges In Excel Using VBA but that would be very inefficient. Every time you read or write something to an excel sheet, you will be consuming considerable