SpreadsheetGear 2023
Columns Property (IRange)

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.
ReadOnly Property Columns As IRange
Dim instance As IRange
Dim value As IRange
value = instance.Columns
IRange Columns {get;}
If the IRange represents more than one range of cells, only the first range of cells is represented in the new IRange.
int numberOfCols = worksheet.Cells["A1:B3"].Columns.Count; // 2 columns
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
AutoFit Method
Count Property
Rows Property
RowCount Property
ColumnCount Property
CellCount Property