![]() |
|
#1
|
|||
|
|||
|
Hi - I am trying to cut text that is in brackets ([text]) from one table cell to another table cell - move all words in brackets from column 3 to column 2.
The macro below works fine ---but if the original cell has 2 sets of bracketed words (e.g. [Set A], [Set B]) then when the text is pasted in the new cell, it overwrites whatever is already in the cell (only end up with [Set B] instead of [Set A] and [Set B]) Instead, I would like to add the pasted text on a new line in the cell with a blank line in between. Any suggestions???? ![]() Code:
Dim keepSearch As Boolean
Dim Count As Integer
ActiveDocument.Tables(1).Select
Do
Selection.Tables(1).Columns(3).Select
With Selection.Find
.ClearFormatting
.Text = "["
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Execute
End With
If Selection.Find.Found Then
Selection.Extend
keepSearch = True
' find second quote of this pair
With Selection.Find
.ClearFormatting
.Text = "]"
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Execute
End With
'Move selected text to column left
Selection.Cut
Selection.MoveLeft Unit:=wdCell
Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveRight Unit:=wdCell
Else
keepSearch = False
End If
Loop While keepSearch
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Can I create a single-cell table that moves with the text?
|
lcaretto | Word Tables | 7 | 11-01-2013 06:04 AM |
| Enter text into next available cell in a table | molesy | Word VBA | 2 | 09-11-2013 02:25 AM |
Text Form Fields - Filling the table cell
|
simville02 | Word Tables | 1 | 01-31-2013 11:12 PM |
| Text Wrapping on Fixed Lines in a Form field/Table cell | okrmjr | Word Tables | 0 | 10-30-2009 08:52 AM |
| Auto-populate an MS Word table cell with text from a diff cell? | dreamrthts | Word Tables | 0 | 03-20-2009 01:49 PM |