search and replace tabs in table

H

Hines

I'd like to create a macro that searches a table column for commas and
replaces them with tabs. I'm not a programmer and only create my macros
using the record function although I can edit VB if I have the right command
language.
 
K

Klaus Linke

Hi,

If you record the macro (Table > Select > Column, Edit > Find, Replace "," with
"^t"), the macro should work fine.
All you'd need to change is replace
..Wrap = wdFindAsk
with
..Wrap = wdFindStop

If you want to search in a certain column, and not the column the cursor happens
to be in, you can select that column at the start of the macro:
Instead of
Selection.SelectColumn
use
Selection.Tables(1).Columns(4).Select
to select, say, the 4th column.

Regards,
Klaus
 
H

hinesgg

That worked, but now I have a new problem. My column originally contained a
list of names separated by commas. The column is a fixed width, and when the
commas are replaced by tabs, some of the names don't wrap to a new line.
Instead, they just continue as if the first names were part of the last name
that appeared before them. I'm trying to find a way to avoid the need to
manually enter a soft return in each situation. Any advice?
 
K

Klaus Linke

That worked, but now I have a new problem. My column originally
contained a list of names separated by commas.
The column is a fixed width, and when the commas are replaced by
tabs, some of the names don't wrap to a new line. Instead, they just
continue as if the first names were part of the last name that appeared
before them. I'm trying to find a way to avoid the need to manually
enter a soft return in each situation. Any advice?


You could force a minimal distance by replacing the tabs with a space and a tab.

But the cleaner solution would be to use two columns? If you convert the table
to (tab-delimited) text, and then back to a table, that should be quick.

Greetings,
Klaus
 

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