NativeExcel2 for .Net Developer's Reference

IRangeRows.Count Property

Returns the number of rows in the range.

[Visual Basic]
PropertyReadOnlyCountAsInteger
[C#]
intCount{get;}
[C++]
__propertyintget_Count();
[JScript]
functiongetCount():int

Example

This example displays the number of rows in the selection on sheet one.

[C#]
 IWorksheet sheet = book.Worksheets[1];
 MessageBox.Show(String.Format("The selection contains {0} rows", sheet.Selection.Rows.Count));
[VisualBasic]
 Dim sheet As IWorksheet = book.Worksheets(1)
 MessageBox.Show(String.Format("The selection contains {0} rows", sheet.Selection.Rows.Count))
[C++]
 IWorksheet* sheet = book->Worksheets->Item[1];
 MessageBox::Show(String::Format(S"The selection contains {0} rows", sheet->Selection->Rows->Count));

See Also

IRangeRows Interface | NativeExcel Namespace | IWorksheet.Selection Property | IRange.Rows Property