Understanding Collections

A collection is an object that contains a group of related objects. For example, the Worksheets collection object contains Worksheet objects. Each object within a collection is called an element of that collection. Because collections are objects, they have properties and methods, just as singular objects do.

In the preceding illustration, the Worksheets method returns a Worksheet object. The method actually returns one member of the Worksheets collection. When you want to work with a single object, you usually return one from a collection. The property or method you use to return the object is called an accessor.

Many accessors take an argument that chooses, or indexes, an object in the collection. For example, the Worksheets method takes an argument that refers to a single worksheet. The argument can be a worksheet name, or it can be a number that corresponds to the position of the worksheet tabs in a workbook, as shown in the following illustration.