NativeExcel for .Net Developer's Reference

IWorksheet.Range Property

Returns an IRange interface that represents all the cells on the worksheet (not just the cells that are currently in use). Read-only.

[Visual Basic]
Property ReadOnly Range As IRange
[C#]
IRange Range { get; }
[C++]
__property IRange* get_Range();
[JScript]
function get Range() : IRange

Property Value

IRange interface.

Remarks

You can also use the Cells property which is synonym for the Range property.

Example

This example sets the value of the cell B3 on sheet one.

[C#]
book.Worksheets[1].Range[3,2].Value = 100;
[Visual Basic]
book.Worksheets(1).Range(3,2).Value = 100
[C++]
book->Worksheets->Item[1]->Range->Item[3,2]->Value = 100;
This example sets the value of the cell F3 on sheet one.
[C#]
book.Worksheets[1].Range["F3"].Value = 100;
[Visual Basic]
book.Worksheets(1).Range("F3").Value = 100
[C++]
book->Worksheets->Item[1]->Range->Item[S"F3"]->Value = 100;
This example merges the cells B2:F4 on sheet one.
[C#]
book.Worksheets[1].Range["B2:F4"].Merge();
[Visual Basic]
book.Worksheets(1).Range("B2:F4").Merge()
[C++]
book->Worksheets->Item[1]->Range->Item[S"B2:F4"]->Merge();

See Also

IWorksheet Interface | NativeExcel Namespace | IRange Interface | Cells Property