Partager via


Range.Range Property

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

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
ReadOnly Property Range ( _
    Cell1 As Object, _
    Cell2 As Object _
) As Range
    Get
'Usage
Dim instance As Range
Dim Cell1 As Object
Dim Cell2 As Object
Dim value As Range

value = instance.Range(Cell1, Cell2)
Range this[
    Object Cell1,
    Object Cell2
] { get; }

Parameters

  • Cell1
    Type: System.Object

    Required Object. The name of the range. This must be an A1-style reference in the language of the macro. It 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 they’re ignored. You can use a local defined name in any part of the range. If you use a name, the name is assumed to be in the language of the macro.

  • Cell2
    Type: System.Object

    Optional Object. The cell in the upper-left and lower-right corner of the range. Can be a Range object that contains a single cell, an entire column, or entire row, or it can be a string that names a single cell in the language of the macro.

Property Value

Type: Microsoft.Office.Interop.Excel.Range

Remarks

This property is relative to the Range object. For example, if the selection is cell C3, then Selection.Range("B1") returns cell D3 because it’s relative to the Range object returned by the Selection property. On the other hand, ActiveSheet.Range("B1") always returns cell B1.

See Also

Reference

Range Interface

Range Members

Microsoft.Office.Interop.Excel Namespace