ColumnIndex Property

Applies To

Cell object.

Description

Returns the number of the table column that contains the specified cell. Read-only Long.

See Also

Columns property, IsFirst property, IsLast property, Item method, RowIndex property.

Example

This example creates a table in a new document, selects each cell in the first row, and returns the column number that contains the selected cell.

Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 3, 3)
For Each aCell In myTable.Rows(1).Cells
    aCell.Select
    MsgBox "This is column " & aCell.ColumnIndex
Next aCell
This example returns the column number of the cell that contains the insertion point.

Msgbox Selection.Cells(1).ColumnIndex