Ridders said:
within Word, I frequently have documents that I review, where text is in
the
form of a table.
I review all words that are shown in brackets, but ideally I am trying to
find out how I can highlight all the text in the brackets, and move it to
a
column to the right...this way it will be easier for me to review the text
in
the brackets.
I hope someone can help!
Many thanks.
Hi,
I hope the macro below works.
If you want to delete the original (brackets), replace
rngFind.Collapse (wdCollapseEnd)
with
rngFind.Delete
The macro copies the text to the next column to the right... else you might
change (i_Col + 1) to something else.
Regards,
Klaus
' put the cursor in the column from which you want to copy the brackets,
' then run this macro.
Dim i As Long, i_Col As Long
i_Col = Selection.Columns(1).Cells(1).ColumnIndex
Dim rngFind As Range
Dim rngMove As Range
Dim myRow As ROW
For Each myRow In Selection.Tables(1).Rows
Set rngFind = myRow.Cells(i_Col).Range
Set rngMove = myRow.Cells(i_Col + 1).Range
rngMove.MoveEnd Unit:=wdCharacter, Count:=-1
rngFind.Find.ClearFormatting
rngFind.Find.Replacement.ClearFormatting
With rngFind.Find
.Text = "\(*\)"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
End With
While rngFind.Find.Execute
rngMove.Collapse (wdCollapseEnd)
rngMove.FormattedText = rngFind
rngFind.Collapse (wdCollapseEnd)
rngFind.MoveEndUntil CSet:=Chr(7), Count:=wdForward
rngFind.MoveEnd Unit:=wdCharacter, Count:=-1
Wend
Next myRow