Move text insertion cursor to the cell below

H

Henry Kwan

I have this macro that does a few formatting settings to the current table
cell (depending on the location of the text insertion cursor).

After running this macro, I wish to move the text insertion cursor to the
cell below the current cell. I tried to use the MoveDown method, however,
this method appears to simulate a down arrow key press. If a cell spans
between two pages, pressing the down arrow key or using this MoveDown method
may or may not move the cursor to the cell below. In most cases, if there is
text in the cells below, left and below, right, the cursor will go to one of
these cells instead of the cell directly below the current cell.

Is there a way to use the GoTo method to accomplish what I want?

Any help is greatly appreciated.
 
H

H. Druss

Henry Kwan said:
I have this macro that does a few formatting settings to the current table
cell (depending on the location of the text insertion cursor).

After running this macro, I wish to move the text insertion cursor to the
cell below the current cell. I tried to use the MoveDown method, however,
this method appears to simulate a down arrow key press. If a cell spans
between two pages, pressing the down arrow key or using this MoveDown
method
may or may not move the cursor to the cell below. In most cases, if there
is
text in the cells below, left and below, right, the cursor will go to one
of
these cells instead of the cell directly below the current cell.

Is there a way to use the GoTo method to accomplish what I want?

Any help is greatly appreciated.

Hi Henry
Try this:
******************************************************
Sub MoveDownOneRow()
Dim iRow As Long, iCol As Long

' get the current row
iRow = Selection.Information(wdEndOfRangeRowNumber)

' get the current column
iCol = Selection.Information(wdEndOfRangeColumnNumber)

' be sure were not in the last row
If iRow < ActiveDocument.Tables(1).Rows.Count Then
ActiveDocument.Tables(1).Cell(iRow + 1, iCol).Select
Selection.Collapse
Else
MsgBox "Selection is in the last row"
End If

End Sub
*******************************************************

Good luck
Harold
 
H

Henry Kwan

Thanks H. Druss.

I was considering some form of Select and Collapse, but I was thinking that
the split-second flash of a cell on the screen might lead to confusion in
terms of usability issues. But it'll have to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top