SpreadsheetGear 2023
Count Property (IRange)
Example 


SpreadsheetGear Namespace > IRange Interface : Count Property
Deprecated - use CellCount, RowCount or ColumnCount.
Syntax
'Declaration
 
<System.ObsoleteAttribute("Use IRange.CellCount, IRange.RowCount or IRange.ColumnCount")>
ReadOnly Property Count As System.Integer
'Usage
 
Dim instance As IRange
Dim value As System.Integer
 
value = instance.Count
[System.Obsolete("Use IRange.CellCount, IRange.RowCount or IRange.ColumnCount")]
System.int Count {get;}
Remarks
NOTE: This property will throw an exception if the count exceeds Int32.MaxValue.
Example
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
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

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

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