NativeExcel for .Net Developer's Reference

IRange.Column Property

Returns the number of the first column in the specified range

[Visual Basic]
PropertyReadOnlyColumnAsInteger
[C#]
intColumn{get;}
[C++]
__propertyintget_Column();
[JScript]
functiongetColumn():int

Example

This example sets the value of A1 cell to the number of the first column in the selection.

[C#]
 IWorksheet sheet = book.Worksheets[1];
 sheet.Range["A1"].Value = sheet.Selection.Column;
[VisualBasic]
 Dim sheet As IWorksheet = book.Worksheets(1)
 sheet.Range("A1").Value = sheet.Selection.Column
[C++]
 IWorksheet* sheet = book->Worksheets->Item[1];
 sheet->Range->Item[S"A1"]->Value = sheet->Selection->Column;

See Also

IRange Interface | NativeExcel Namespace | Selection Property | Row Property