NextCell, NextCell()

Syntax

NextCell

NextCell()

Remarks

The NextCell statement selects the contents of the next table cell (the same as pressing TAB in a table). If more than one cell is selected, NextCell selects the contents of the first cell in the selection. If the insertion point or selection is in the last cell of the table, NextCell adds a new row.

The NextCell() function behaves the same as the statement except when the insertion point or selection is completely within the last cell. In that case, the function returns 0 (zero) without enlarging the section, whereas the statement adds a new row.

Note

You can use EditGoTo .Destination = "\Cell" to select the contents of the current cell. The predefined bookmark " \ Cell" and a number of others are set and updated automatically. For information on predefined bookmarks, see "Operators and Predefined Bookmarks" later in this part.

Examples

This example moves the selection to the next cell, and then uses SelType() to determine if the cell is empty. If SelType() returns 1 (the value for the insertion point, indicating the cell is empty), a message box appears.


NextCell
If SelType() = 1 Then MsgBox "Empty cell!"

The following example uses the NextCell() function to determine if the insertion point is in the last cell. If the current cell is the last cell, the entire table is selected. If the current cell is not the last cell, the next cell is selected.


If NextCell() = 0 Then TableSelectTable

See Also

PrevCell