NativeExcel2 for .Net Developer's Reference

IRange.Item Property (String)

Returns an IRange interface that represents a cell or range of cells by using A1 reference style.

[C#] In C#, this property is the indexer for the IRange class.

[Visual Basic]
DefaultPropertyReadOnlyItem(_
ByValrangeAsString_
)AsIRange
[C#]
IRangethis[
stringrange
]{get;}
[C++]
__propertyIRange*get_Item(
String*range
);
[JScript]
returnValue = IRangeObject.Item( range );
-or-
returnValue = IRangeObject( range );

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Parameters

range
String that indicates a cell or a range of cells by using A1 reference style.

Property Value

Returns an IRange interface.

Example

This example sets the value of cell B10 on the first sheet to 100.

[C#]
book.Worksheets[1].Range["B10"].Value = 100;
[VisualBasic]
book.Worksheets(1).Range("B10").Value = 100
[C++]
book->Worksheets->Item[1]->Range->Item[S"B10"]->Value = 100;
This example sets the font style in cells A1:D10 on the first sheet to bold.
[C#]
book.Worksheets[1].Range["A1:D10"].Font.Bold = true;
[VisualBasic]
book.Worksheets(1).Range("A1:D10").Font.Bold = True
[C++]
book->Worksheets->Item[1]->Range->Item[S"A1:D10"]->Font->Bold = true;

See Also

IRange Interface | NativeExcel Namespace | IRange.Item Overload List | How to reference Cells and Ranges