See Also

IRange Interface  | IRange Members  | AreaCount Property  | RowCount Property  | ColumnCount Property  | Columns Property  | Rows Property

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages SpreadsheetGear The Performance Spreadsheet Component Company 

Count Property

SpreadsheetGear Namespace > IRange Interface : Count Property (IRange)

Returns the number of cells, rows, or columns in a range.

[Visual Basic]
Overridable ReadOnly Property Count As Integer
[C#]
virtual int Count {get;}
[C++]
__property virtual int get_Count();
[C++/CLI]
virtual property int Count {    int get(); }

Example

[C#] 

int numberOfCells = worksheet.Cells["A1:B3"].Count; // 6 cells 
int numberOfRows = worksheet.Cells["A1:B3"].Rows.Count; // 3 rows 
int numberOfCols = worksheet.Cells["A1:B3"].Columns.Count; // 2 columns 
    

[Visual Basic] 

Dim numberOfCells As Integer = worksheet.Cells("A1:B3").Count ' 6 cells
Dim numberOfRows As Integer = worksheet.Cells("A1:B3").Rows.Count ' 3 rows
Dim numberOfCols As Integer = worksheet.Cells("A1:B3").Columns.Count ' 2 columns

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IRange Interface  | IRange Members  | AreaCount Property  | RowCount Property  | ColumnCount Property  | Columns Property  | Rows Property

 

 


See our live Excel Reporting, Excel Charting, Excel to DataGrid and Excel Calculation Samples.

Copyright © 2003-2007 SpreadsheetGear LLC. All Rights Reserved.

SpreadsheetGear and Spreadsheet Gear are trademarks of SpreadsheetGear LLC.