Word Macro: Move Cursor Down a Row
- by Bryan
I have a macro which I've been using to merge two cells together in a word table, but what I want to do is to get the cursor to move down by one cell, so that I can repeatedly press the shortcut key to repeat the command over and over.
The macro code that I have (shamelessy copied and pasted from a web page), is as follows:
Sub MergeWithCellToRight()
'
' MergeWithCellToRight Macro
'
'
Dim oRng As Range
Dim oCell As Cell
Set oCell = Selection.Cells(1)
If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then
MsgBox "There is no cell to the right?", vbCritical, "Error"
Exit Sub
End If
Set oRng = oCell.Range
oRng.MoveEnd wdCell, 1
oRng.Cells.Merge
Selection.Collapse wdCollapseStart
End Sub
I've attempted to add the following line just before the 'End Sub' statement
Selection.MoveDown wdCell, 1
but this generates the error, Run-time error '4120' Bad Parameter whenever I execute the macro.
Can anyone tell me how to correct this or what I'm doing wrong?