Merge columns not rows

M

Microchip

I have a large table (160 pages) where I want to combine four (address)
columns into one. Word doed exactly that one cell containing 4 columns and
160 rows of data. How can I merge the four columns in each row without doing
it row by row?

Thanks
 
S

Suzanne S. Barnhill

This is one instance where the Eraser tool on the Tables & Borders toolbar
really comes in handy. Use it to "erase" the boundaries between the cells.
 
D

Doug Robbins - Word MVP

Use a macro containing the following code:

Dim i As Long, j As Long
Dim element As Range
Dim address As String
With Selection.Tables(1)
For i = 1 To .Rows.Count
address = ""
For j = 1 To 3
Set element = .Cell(i, j).Range
element.End = element.End - 1
address = address & element.Text & vbCr
Next j
Set element = .Cell(i, 4).Range
element.End = element.End - 1
address = address & vbCr
.Cell(i, 1).Range.Text = address
Next i
For i = 4 To 3 Step -1
.Columns(i).Delete
End With

Or use a Directory type mail merge with your existing table as the
datasource and in the mail merge main document, insert a one cell table and
into that cell, insert the field names of the 4 columns in the configuration
that you want and then execute the merge to a new document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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