Column related procedures in class Cell (Word VBA)

This page presents procedures from class Cell related to the theme Column: Column and ColumnIndex

Column

Returns a Column object that represents the table column containing the specified cell.

Dim tableNew As Table 
Dim cellLoop As Cell 
 
Selection.Collapse Direction:=wdCollapseStart 
Set tableNew = _ 
 ActiveDocument.Tables.Add(Range:=Selection.Range, _ 
 NumRows:=3, NumColumns:=5) 
 
For Each cellLoop In tableNew.Rows(1).Cells 
 If cellLoop.ColumnIndex Mod 2 = 0 Then 
 cellLoop.Column.Shading.Texture = wdTexture10Percent 
 End If 
Next cellLoop

ColumnIndex

Returns the number of the table column that contains the specified cell.

Dim docNew As Document 
Dim tableNew As Table 
Dim cellLoop As Cell 
 
Set docNew = Documents.Add 
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3) 
For Each cellLoop In tableNew.Rows(1).Cells 
 cellLoop.Select 
 MsgBox "This is column " & cellLoop.ColumnIndex 
Next cellLoop