SpreadsheetGear 2023
Columns Property (IRange)
Example 


SpreadsheetGear Namespace > IRange Interface : Columns Property
Returns a new instance of IRange which represents the same range of cells but which may be used to determine the number of columns in the range or to AutoFit the columns in the range.
Syntax
'Declaration
 
ReadOnly Property Columns As IRange
'Usage
 
Dim instance As IRange
Dim value As IRange
 
value = instance.Columns
IRange Columns {get;}
Remarks
If the IRange represents more than one range of cells, only the first range of cells is represented in the new IRange.
Example
int numberOfCols = worksheet.Cells["A1:B3"].Columns.Count; // 2 columns
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
AutoFit Method
Count Property
Rows Property
RowCount Property
ColumnCount Property
CellCount Property