View Single Post
  #6  
Old January 30th, 2010, 01:57 AM posted to microsoft.public.word.tables
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Dividing one column into two in a six-column table

Hi Transcribe,

OK. Here's how:
1. Open your document and press Alt-F11. This will open the vba environment.
2. In the left hand panel, select your document if it isn't already selected.
3. If you don't see a 'Modules' entry there, click Insert|Module. This will create a new vba module for you.
4. Copy & paste the macro from my post into the module.
5. You now have two choices - run the macro from here or go back to the document and run the macro from there.
. a) To run the macro from here, simply press F5.
. b) To run the macro from the document, press Alt-F11 again, then press Alt-F8 and choose the 'Move_Maidens' entry.
Note: In either case, the macro won't do anything if you the selection point isn't in the table.

From now on, you'll get a macro warning message when you open the document, but having the macro in it also means it's available to
anyone who works on this document. Running it multiple times won't do any harm - it simple processes whatever table the selection
point is in (you don't have to select the whole table), and moves any square-bracketed text from column2 to column3 (replacing
whatever else might have been in column3). If you don't want the macro warning message, you can instead insert the macro into the
'Normal' file that you should see at step 2 above. That makes the macro available to any file you've got open, but not to anyone
else whose got the table document open.

--
Cheers
macropod
[Microsoft MVP - Word]


"Transcribe" wrote in message ...
Hello, again, Macropod,

Thank you so much for taking the time to write this macro. You say this
macro will move any text between square brackets in the second column to the
third column...and that's exactly what I need to do! I have read Help for
"Create a macro" and for "Run a macro," and I am having no luck making it
work. I'm unfamiliar with macros (having had my measly two MS Word classes
about 15 years ago). When I attempt to "run" the macro, it just puts the text
of the macro in my document. Yikes! It may take you too much time to lead me
through the steps to create and utilize this macro, as that may not be within
the scope of this discussion group.

Transcribe

"macropod" wrote:

Hi Transcribe,

Yes the column would be blank. If you've only got a few maiden names to process, it wouldn't take much effort to transfer them
manually. If you got many to process, you could use the following macro:

Sub Move_Maidens()
Dim oCel As Cell
Application.ScreenUpdating = False
With Selection
If Not .Information(wdWithInTable) Then Exit Sub
For Each oCel In .Tables(1).Columns(2).Cells
With oCel.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\[[!\[\]]{1,}\]"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute
If .Found = True Then
oCel.Next.Range.Text = .Parent.Text
.Parent.Delete
End If
End With
Next
End With
Application.ScreenUpdating = True
End Sub

Note that this macro will move any text between square brackets in the second column to the third column.

--
Cheers
macropod
[Microsoft MVP - Word]