The Boss Macro

We’ll make this an April Fools’ Day tradition. Last year, I created The Garbage Financial Statement — a prank financial statement that would flip data whenever entered into a cell, and subsequently move the data to an adjacent cell whenever the user attempted to delete it. I wouldn’t recommend sending …

Creating a Collection Class within a Collection Class

A common object structure in VBA is the collection class, where many custom objects are grouped together. VBA also permits additional layers above the collection class, resulting in a collection within a collection. This is a useful technique for organizing hierarchical data or grouping certain objects.

Using Class Initialize in Collection Classes

Class Initialize is known as an intrinsic (native) procedure that triggers when a custom object is initialized. Did you know that this procedure will also work within collection classes? When used properly, class initialize can help set up collections by using default data or loading from saved data.

Saving Custom Object Data in a Workbook

Previous posts have discussed advantages to using custom objects and custom collections. When used as globals within a VBA, custom objects provide a means of storing complex data structures outside of a standard worksheet. The efficiency gains and ease of access can help you build robust programs. Unfortunately, these custom …

Using Custom Keys in Collection Classes

Accessing a specific object within a collection class can be a challenging endeavor. By assigning a proper custom key to objects in a collection class, you can avoid the often cumbersome error handling and loop searches often used to retrieve objects.

Building a Custom Collection Class

A Collection class is a useful means to manage a large group of custom objects. The ability to store multiple classes permits the efficient operation of VBA projects, while keeping code clean and readable.

Building a Custom Class: Part 2

Classes and objects open up a host of opportunities within Excel VBA. In addition to being a powerful feature in their own right, classes can utilize every VBA coding technique, and permit small project teams to work on large-scale VBA projects with ease. By learning and fully understanding VBA classes …

Building a Custom Class: Part 1

If you’ve followed the series up to this point, you have previously worked with intrinsic (built-in) objects like Range, Shape, or Worksheet. In addition to these intrinsic objects, VBA offers the ability to build custom objects through the creation of a class.