NativeExcel for .Net Developer's Reference

IRange.Item Property (String, 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(_
ByValcell1AsString,_
ByValcell2AsString_
)AsIRange
[C#]
IRangethis[
stringcell1,
stringcell2
]{get;}
[C++]
__propertyIRange*get_Item(
String*cell1,
String*cell2
);
[JScript]
returnValue = IRangeObject.Item( cell1,cell2 );
-or-
returnValue = IRangeObject( cell1,cell2 );

[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

cell1
String. This must be an A1-style reference to the cell in the upper-left corner of the range.
cell2
String. This must be an A1-style reference to the cell in the lower-right corner of the range.

Property Value

Returns an IRange interface.

Example

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", S"D10"]->Font->Bold = true;

See Also

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