Range Property

As it applies to the AutoFilter object.

Returns a Range object that represent the range of cells that the specified AutoFilter object applies to.

expression.Range

*expression   * Required. An expression that returns an AutoFilter object

As it applies to the PivotData object.

Returns a PivotRange object that represents a cell or a range of cells.

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.

Returns a Range object that represents a cell or rectangular range of cells. It is not possible to create a range that is not rectangular or a range composed of areas that are not contiguous.

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")

As it applies to the Range, Spreadsheet, and Worksheet objects.

Returns a Range object that represents a cell or rectangular range of cells. It is not possible to create a range that is not rectangular or a range composed of areas that are not contiguous.

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")

As it applies to the ListObject object.

Returns a Range object that represents the range where the specified XML list is located. Includes the header row (if present) and insert row. Read-only.

expression.Range

*expression   * Required. An expression that returns a ListObject object.

Remarks

Some properties and methods of the Range object are not supported for ranges returned from ListObject objects. In these cases, a run-time error is generated.

LockedMergeAreaMergeCellsDeleteInsertMergeUnMerge

The AutoFilter and Sort methods are supported, but always apply to the entire list.

As it applies to the ListRow object.

Returns a Range object that represents the range to which the specified XML list row applies. Read-Only

expression.Range

*expression   * Required. An expression that returns a ListRow object.

Remarks

Some properties and methods of the Range object are not supported for ranges returned from ListRow objects. In these cases, a run-time error is generated.

LockedMergeAreaMergeCellsDeleteInsertMergeUnMerge

Example

As it applies to the Range, Spreadsheet, and Worksheet objects.

This example sets the row height to 15 points for rows 1 through 10.

Spreadsheet1.Range("a1:a10").RowHeight = 15

This example sets a variable to a range that includes the second through last row of columns 3 and 4 in the current region for cell A1.

Sub GetRange()

   Dim rngCurRegion
   Dim rngTempRange

   Set rngCurRegion = Spreadsheet1.Range("a1").CurrentRegion

   Set rngTempRange = rngCurRegion.Range(rngCurRegion.Cells(2, 3), _
       curRegion.Cells(rngCurRegion.Rows.Count, 4))

End Sub

Applies to | AutoFilter Object | ListObject Object | ListRow Object | PivotData Object | Range Object | Spreadsheet Object | Worksheet Object

See Also | ActiveCell Property