Range Property

See Also         Example         Applies To

SpreadsheetEventInfo object: Returns a Range object that represents the range where the specified event occurred. For more information, see the specific event topics. This property has no arguments when it is used with the SpreadsheetEventInfo object. Read-only.

PivotData object (Syntax 1): Returns a PivotRange object that represents a cell or a range of cells. Read-only.

Range, Spreadsheet, or Worksheet object (Syntax 2): Returns a Range object that represents a cell or rectangular range of cells. It is not possible to create a nonrectangular range or a range composed of discontiguous areas. Read-only.

Syntax 1 (PivotData object)

expression.Range(TopLeft, BottomRight)

expression   An expression that returns a PivotData object.

TopLeft   Required PivotCell object. Specifies the upper-left cell in the specified range.

BottomRight   Required PivotCell object. Specifies the lower-right cell in the specified range.

Syntax 2 (Range, Spreadsheet, or Worksheet object)

expression.Range(Cell1, Cell2)

expression   An expression that returns a Range, Spreadsheet, or Worksheet object.

Cell1   Required Variant. Specifies the entire range as an A1-style reference ("A1:C3", for example). The reference can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). It can also include dollar signs, but these are ignored. The reference can also specify the cell in the upper-left corner of the range as a Range object that contains a single cell, an entire column, or an entire row, or as a string that names a single cell. If Cell1 specifies the upper-left cell in the range, Cell2 is required.

Cell2   Optional Variant. (Required if Cell1 specifies the upper-left cell in the specified range.) Specifies the cell in the lower-right corner of the range. Can be a Range object that contains a single cell, an entire column, or an entire row, or it can be a string that names a single cell.

Remarks

When this property is applied to a Range object, the arguments specify cells relative to the range. The following example sets a variable to a Range object that represents cell B5.

Set tempRange = Spreadsheet1.Range("b5:b10").range("a1")