SpreadsheetGear 2017
Count Property (IRange)

SpreadsheetGear Namespace > IRange Interface : Count Property
Deprecated - use CellCount, RowCount or ColumnCount.
<System.ObsoleteAttribute("Use IRange.CellCount, IRange.RowCount or IRange.ColumnCount")>
ReadOnly Property Count As System.Integer
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;}
read-only property Count: System.Integer; 
System.ObsoleteAttribute("Use IRange.CellCount, IRange.RowCount or IRange.ColumnCount")
function get Count : System.int
[System.Obsolete("Use IRange.CellCount, IRange.RowCount or IRange.ColumnCount")]
__property System.int get_Count();
[System.Obsolete("Use IRange.CellCount, IRange.RowCount or IRange.ColumnCount")]
property System.int Count {
   System.int get();
NOTE: This property will throw an exception if the count exceeds Int32.MaxValue.
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

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


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