Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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?

share|improve this question
up vote 1 down vote accepted

No idea if that could help, but I have the following:

Sub Merges2Cols()
Dim nbLines As Integer
    nbLines = 10     'you'd have to count the number of lines you want to merge
    For i = 1 To nbLines
        Selection.MoveRight Unit:=wdCharacter, Count:=2, Extend:=wdExtend
        Selection.MoveDown Unit:=wdLine, Count:=1
End Sub
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.