#1
|
|||
|
|||
Merge only the text in a table and keep the 2 original colums of a table
I need to merge only the text that is inside 2 different columns in a Word 2010 table.
The only merge option i can see actually merges say 2 columns into 1 column, but I only need to merge the contents and do not wish to lose one of the columns. I hope this makes sense and is something that can be done as it seems fairly easy but I can't figure it out. Any help or advice will be appreciated. James |
#2
|
||||
|
||||
You can merge the cells on just one row, which means your two columns become one on just that row; or you can drag the text from one column to the other. The dragged content will be inserted at wherever you stop the insertion point.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks for your help Paul. The drag option is what I'm looking for as I need to keep both columns after any text has been moved.
Is there any way of automating this or is there any software that is already in the market in the form of an add-in? If not would a macro be able to do this? I need to be able to move the text from column A to column B sometimes several hundred times per document so the drag and drop option although works, will be extremely time consuming and tedious. James |
#4
|
||||
|
||||
Whilst it might be possible to automate the process with a macro, the difficulty of doing so depends on the table structure for each table that is to be processed, especially if only some of the tables are to be processed and/or you need to transfer the data from different columns in different tables.
In some respects, the simplest approach may be to merge the cells horizontally, then split them horizontally again. And a macro could certainly be written for that part - provided the column widths within the table are consistent.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
ok thanks Paul.
If anyone else out there can think of any other ways please let me know. |
#6
|
||||
|
||||
Try the following. It works with a range of selected cells.
Code:
Sub CellXfer() Application.ScreenUpdating = False Dim i As Long, RngTbl As Range, RngCell As Range Set RngTbl = Selection.Range On Error Resume Next With RngTbl If .Information(wdWithInTable) = True Then For i = 1 To .Cells.Count Step 2 If .Cells(i).Row.Index = .Cells(i + 1).Row.Index Then Set RngCell = .Cells(i + 1).Range With RngCell .End = .End - 1 .Cut End With Set RngCell = .Cells(i).Range With RngCell .End = .End - 1 If Len(.Text) = 0 Then .Paste ElseIf .Characters.Last = vbCr Then .Collapse wdCollapseEnd .Paste Else .Characters.Last.InsertAfter vbCr .Collapse wdCollapseEnd .Paste End If End With End If Next End If End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
merge, table |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mail Merge Into Dynamic Table | Jag618 | Mail Merge | 1 | 03-04-2013 11:26 PM |
Cannot Merge Into A Table | MacDee | Mail Merge | 1 | 01-29-2013 07:21 PM |
mail merge with table | nadja | Mail Merge | 5 | 03-06-2012 05:41 PM |
Merge Two Table in VBA | donbexcel | Word VBA | 2 | 10-21-2011 11:46 AM |
Select Text in Table but Table Gets Selected Too | RBusiness | Word | 1 | 06-07-2011 04:26 PM |