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]
PropertyReadOnlyRangeAsIRange
[C#]
IRangeRange{get;}
[C++]
__propertyIRange*get_Range();
[JScript]
functiongetRange():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;
[VisualBasic]
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;
[VisualBasic]
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();
[VisualBasic]
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