RowIndex Property Example

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

Set newDoc = Documents.Add 
Set myTable = newDoc.Tables.Add(Range:=Selection.Range, _
    NumRows:=3, NumColumns:=3)
For Each aCell In myTable.Columns(1).Cells
    aCell.Select
    MsgBox "This is row " & aCell.RowIndex
Next aCell

This example displays the row number of the first row in the selection.

If Selection.Information(wdWithInTable) = True Then
    Msgbox Selection.Cells(1).RowIndex
End If