Areas Collection
Excel Developer Reference |
A collection of the areas, or contiguous blocks of cells, within a selection.
Remarks
There’s no singular Area object; individual members of the Areas collection are Range objects. The Areas collection contains one Range object for each discrete, contiguous range of cells within the selection. If the selection contains only one area, the Areas collection contains a single Range object that corresponds to that selection.
Example
Use the Areas property to return the Areas collection. The following example clears the current selection if it contains more than one area.
Visual Basic for Applications |
---|
|
Use Areas(
index
), where
index
is the area index number, to return a single Range object from the collection. The index numbers correspond to the order in which the areas were selected. The following example clears the first area in the current selection if the selection contains more than one area.
Visual Basic for Applications |
---|
|
Some operations cannot be performed on more than one area in a selection at the same time; you must loop through the individual areas in the selection and perform the operations on each area separately. The following example performs the operation named "myOperation" on the selected range if the selection contains only one area; if the selection contains multiple areas, the example performs myOperation on each individual area in the selection.
Visual Basic for Applications |
---|
|
See Also