Object collections

When we talk about real-world objects such as a television set, we think of a particular object, but it is just one of a collection of many others (a very large number in the entire world). This collection of objects is not the same thing as an individual object in the collection but it can be regarded as an object in its own right.

In the same way, we can talk about an object collection when dealing with Excel/VBA objects. We can define a collection as a group of related objects. Like other objects, collections have methods and properties associated with them. The most commonly used collection property is Count, whilst the most commonly used method is Add. As the name suggests, Count is used to count the number of objects in a collection; while the Add method is used to add a new object to a collection.

0 0

Post a comment