Is there a macro or feature to remove duplicate entries in a list?

  • Thread starter Thread starter Phillip Pi
  • Start date Start date
P

Phillip Pi

For example in a Word 2000 document:

apple
apple
pizza
orange
banana
banana
jello
pizza

Is there a macro or feature in Word 2000 that will delete those
duplicates so I only have one of each item in the list (apple, pizza,
orange, banana, and jello)?

I want to avoid using Access, Excel, etc. to do this simple task. Thank
you in advance.
--
Phillip Pi
(e-mail address removed) (remove SYMC to reply by e-mail)
Software Quality Assurance Analyst
Norton SystemWorks (PC)
Symantec

Please do NOT e-mail me for technical support. DISCLAIMER: The views
expressed in this posting are mine, and do not necessarily reflect the
views of my employer.
 
Yes, pargraph marks but not sure about sorted. They're basically
exported registry keys. How do I use these scripts? I never used VBA before.

Thank you in advance. :)


Phillip,

If your list is separated by paragraph marks and sorted you can use:

http://word.mvps.org/FAQs/MacrosVBA/DeleteParaRnge.htm

This will work on the example you provided, but if you had




Then you will need to sort first
--
Phillip Pi
(e-mail address removed) (remove SYMC to reply by e-mail)
Software Quality Assurance Analyst
Norton SystemWorks (PC)
Symantec

Please do NOT e-mail me for technical support. DISCLAIMER: The views
expressed in this posting are mine, and do not necessarily reflect the
views of my employer.
 
Sort the list then create a wildcard search for
(*^13){1,}
replace with
\1

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Sort the list then create a wildcard search for
(*^13){1,}
replace with
\1

Thanks, but I have a new problem. Word 2000 can't handle 34,157 lines (a
list of registry keys in a huge text file). I get an error with Table's
sort: The document is too large for Word to handle. :(

I filled "Find What" with (*^13){1,} and "Replaced With" with \1
It didn't seem to work. I get "The search item was not found." when I do
a replace.
--
"I got worms! That's what we're going to call it. We're going to
specialize in selling worm farms. You know like ant farms. What's the
matter, a little tense about the flight?" --Lloyd Christmas (Dumb and
Dumber movie)
/\___/\
/ /\ /\ \ Phillip Pi (Ant) @ The Ant Farm: http://antfarm.ma.cx
| |o o| | E-mail: (e-mail address removed) or (e-mail address removed)
\ _ / Be sure you removed ANT from e-mail address if you get
( ) a returned e-mail.
 

Thanks. :)
--
"Ants are so much like human beings as to be an embarrassment. They farm
fungi, raise aphids as livestock, launch armies into wars, use chemical
sprays to alarm and confuse enemies, capture slaves. The families of
weaver ants engage in child labor, holding their larvae like shuttles to
spin out the thread that sews the leaves together for their fungus
gardens. They exchange information ceaselessly. They do everything but
watch television." --Lewis Thomas
/\___/\
/ /\ /\ \ Phillip Pi (Ant) @ The Ant Farm: http://antfarm.ma.cx
| |o o| | E-mail: (e-mail address removed) or (e-mail address removed)
\ _ / Be sure you removed ANT from e-mail address if you get
( ) a returned e-mail.
 
Phillip,

If your list is separated by paragraph marks and sorted you can use:

http://word.mvps.org/FAQs/MacrosVBA/DeleteParaRnge.htm

This will work on the example you provided, but if you had




Then you will need to sort first

Awesome and thanks! This macro seems to work very well! Is this really a
problem if I cannot sort the huge list? Word 2000 couldn't handle 34,157
lines (a list of registry keys in a huge text file). I got an error with
Table's sort: The document is too large for Word to handle. :(

The macro ran fine though! I hope I didn't lose anything important. I
didn't see any duplicate lines so far.
--
"Ants are so much like human beings as to be an embarrassment. They farm
fungi, raise aphids as livestock, launch armies into wars, use chemical
sprays to alarm and confuse enemies, capture slaves. The families of
weaver ants engage in child labor, holding their larvae like shuttles to
spin out the thread that sews the leaves together for their fungus
gardens. They exchange information ceaselessly. They do everything but
watch television." --Lewis Thomas
/\___/\
/ /\ /\ \ Phillip Pi (Ant) @ The Ant Farm: http://antfarm.ma.cx
| |o o| | E-mail: (e-mail address removed) or (e-mail address removed)
\ _ / Be sure you removed ANT from e-mail address if you get
( ) a returned e-mail.
 
Ant,

I don't know of any way for Word to find two or more like items separtated
by different items and then delete all but one. Not saying it can't be
done, only I don't know how. It think you have to sort first.

You might break up your document into a few smaller files, cleanup, and then
recombine and cleanup again.
 
I don't know of any way for Word to find two or more like items separtated
by different items and then delete all but one. Not saying it can't be
done, only I don't know how. It think you have to sort first.

You might break up your document into a few smaller files, cleanup, and then
recombine and cleanup again.

Do you know what is the maximum lines that Word 2000 can handle for me
to split?
--
"When I am at my lowest, that is when I see things the clearest. It's
hard to care about ants when you're soaring with eagles." --unknown
/\___/\
/ /\ /\ \ Phillip Pi (Ant) @ The Ant Farm: http://antfarm.ma.cx
| |o o| | E-mail: (e-mail address removed) or (e-mail address removed)
\ _ / Be sure you removed ANT from e-mail address if you get
( ) a returned e-mail.
 
I am not sure what you hope to achieve by sorting a registry file, but
putting that aside, UltraEdit32 will sort a file of this size without
problem.

Did you check the wildcard box for the search?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
I am not sure what you hope to achieve by sorting a registry file, but
putting that aside, UltraEdit32 will sort a file of this size without
problem.

OK. I will check that out.

Did you check the wildcard box for the search?

Ah, no I didn't. I ran a wildcard search for: (*^13){1,} and replace
with: \1 ... It doesn't seem to work on huge text file (34K lines), but
it does work if I do small portions (50 lines). Hmm, odd.
--
"The Hunam Tiger ant has been known to consume an entire meal before the
picnic guest arrive." --12th century Tang Dynasty proverb.
/\___/\
/ /\ /\ \ Phillip Pi (Ant) @ The Ant Farm: http://antfarm.ma.cx
| |o o| | E-mail: (e-mail address removed) or (e-mail address removed)
\ _ / Be sure you removed ANT from e-mail address if you get
( ) a returned e-mail.
 
Back
Top