The data in this document is just tab delimited text, they are not in a table. The data need not remain in the same order but since it is not a table im not sure how we can sort it?
Main Topics
Browse All TopicsHello I am looking for help with a macro that does the following. I have a word document with lines like so...
853535 01/08/03 1257426 13,608.0 John
854355 01/08/03 1257430 13,840.0 Welsh
853535 01/08/03 1257426 13,608.0 John
854355 01/08/03 1257430 13,840.0 Pink
853535 01/08/03 1257426 13,608.0 Yellow
854355 01/08/03 1257430 13,840.0 Blue
I need to find and delete all lines except those that have the word Welsh in them. Please could you help me out.
Thanks
Welsh
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Not really, if you can keep it in Word. Most of us know how to accomplish that easily in Excel; some of us know how to accomplish it just as easily in Word.
I immediately felt that this is something highenergystar needs to do regularly or they wouldn't be looking for a macro in the first place. Copying and pasting to Excel and then back again unnecessarily uses system resources. Actually, really good coding never (or rarely) uses "copy/paste". Don't ask me how, but they usually manipulate the data in some other way.
This is a plain word file and does have carriage returns at the end of each line, it was created by a person who cut and paste the whoel file form a text file into word
the file is a lot more complicated than this it is actually a form of a report and i need to extract only relevant lines, so i cant quite move it to excel
hope this clarifies stuff, i really look forward to you help
sincerely
welsh
Right, then. Try this one:
Sub KeepWelshLines()
Selection.HomeKey Unit:=wdStory
Selection.Find.Text = "welsh"
Do While Selection.Find.Execute(Fin
Format:=True) = True
With Selection
.Expand Unit:=wdLine
.Font.Bold = True
End With
Loop
Selection.HomeKey Unit:=wdStory
noParas = ActiveDocument.Paragraphs.
For myLoop = 1 To noParas
If Selection.Font.Bold = False Then
Selection.Expand Unit:=wdParagraph
Selection.Delete
Else
Selection.MoveDown , Count:=1
End If
Next
Selection.WholeStory
Selection.Font.Bold = False
End Sub
And bruintje, you're a real gent for giving me the chance to put this right!
Regards.
Ray
highenergystar,
No comment has been added lately, so it has been considered abandoned.
If this question isn't revived and no action is taken I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: Award points to RayBlake http:#7711682
highenergystar and experts, please leave any comments here within 7 days since this will be finalized by a moderator that will use those comments to make the final decision.
-- Please DO NOT accept this comment as an answer ! --
Thanks,
Paulo
EE Cleanup Volunteer
---------------------
[Please read http://www.cityofangels.co
Business Accounts
Answer for Membership
by: DreamboatPosted on 2003-01-10 at 08:14:45ID: 7702515
Are the lines tab-delimited or in a table?
Can you sort the table or must they remain in the same order?