Sorting Objects of a Collection Class

One feature noticeably absent from VBA is a built-in function to sort arrays and collections. The bubble sort is a well known technique for sorting groups of elements when no native function exists. With a few minor adjustments, a bubble sort can also be used to sort collections of custom …

VLOOKUP… to the Left!

Have you ever been attempted to use VLOOKUP in a large data set, only to realize the data you’re seeking is to the left of the lookup column? Sure, you could cut/paste the lookup column the left of the table, but that might interfere with other parts of the dataset. …

Creating and Using Enumerations in VBA

Enumerations are data structures useful for grouping a elements which can be (or need to be) be associated with numeric values. Examples of useful enumerations are products with product IDs, or working with date values, such as months 1 through 12. Many developers also use enumerations to manage events, such …

Creating and Using Collections in VBA

Similar to arrays, Collections are data structures which can store many values. While each have their own benefits, Collections do not need to be manually resized and are very useful when working with dynamic lists and other data.

Creating and Using Multi-Dimensional Arrays in VBA

Building upon the one-dimensional array tutorial, multi-dimensional arrays provide an opportunity to easily create or transfer large tables of data. In many instances, thousands of data points can be created with a few simple lines of code. Note: multi-dimensional arrays can be inefficient and difficult to manage for complex sets …

Nested Loops – Looping Within Loops

While stand-alone loops will accomplish many tasks that require basic iteration, loops can be nested within other loops. In Excel, nested loops provide robust functionality to complete a number of tasks, such as filling out spreadsheet data, creating multidimensional arrays, or formatting cells.

Interact with Spreadsheets Using a VBA For Loop

The For Loop is the most basic iterative loop, permitting a block of code to be executed for a specific number of times. Nested within a for loop, scripts can help input, modify, or remove data from spreadsheets.