Areas Method

Applies To

Range Object.

Description

Accessor. Returns an object that represents a single range (a Range object, Syntax 1), or a collection of all ranges (an Areas object, Syntax 2) in a multiple selection.

Syntax 1

object.Areas(index)

Syntax 2

object.Areas

object

Required. The multiple-selection range.

index

Required for Syntax 1. The number of the range within the multiple selection.

Remarks

For a single selection, the Areas method returns a collection of one object, the original Range object itself. For a multiple selection, the Areas method returns a collection that contains one object for each selection.

See Also

Union Method.

Example

This example displays a message if the user tries to carry out a command when more than one area is selected. This example must be run from a worksheet.


If Selection.Areas.Count > 1 Then
    MsgBox "Cannot do this to a multi-area selection."
End If