Merging rows (from a large number) by two

A

am

Hello,

I have a Microsoft Office Word 2007 table with two columns and many
rows. In both columns, I'd like to merge rows by two (i.e., rows 1 and
2 together, rows 3 and 4 together, rows 5 and 6...) Is there an easy
way to do this? Highlighting cells by two would take very long.

Many thanks in advance,

A.
 
M

Mark Tangard

Hi Andrea,

Word doesn't actually let you merge whole rows in one swoop, only cells.
This'll work, assuming the table is uniform (hasn't got any merged cells
already) and has an even number of rows. It also assumes you want the
cell pairs' content merged in a very ordinary way, with a pgph mark
separating them.

Sub MergeVerticalCellPairs()
Dim d As Document, t As Table, i As Long, j As Long
Set d = ActiveDocument
Set t = Selection.Tables(1)
For i = t.Rows.Count - 1 To 1 Step -2
For j = 1 To t.Columns.Count
d.Range(t.Cell(i, j).Range.Start, t.Cell(i + 1, j).Range.End).Select
Selection.Cells.Merge
Next j
Next i
End Sub

Hope this helps.

Mark Tangard
Word MVP 2001-2004
 

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