Find and Delete line of text

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

I want to find a word/phrase in a line and then delete that line of text. Is
there a way to do that easily? Does it require a macro?

Example: Find "BUILTIN", a word somewhere in a line of text in a document.
Then delete the line of text that contains the word "BUILTIN".
 
You can easily locate a word/phrase by typing "Ctrl" + "F" at the same time
(or clicking on "Edit" - "Find") - type the word(s) in the text box and click
"Find Next" (you can also check the "Highlight all items found..." so you can
see where all occasions of the word or phrase occur). When you find them,
highlight what you need and delete.

Hope this helps,
MarLou
 
Thanks for reponse. Clearly I didn't express what I am looking to do. After
"finding" I want to delete the line with "Delete Line" function or better,
"Highlight all items found..." and then delete all lines. Looking for
something more automated than doing the selection "by hand". Macro code is
ok if Word doesn't have a "Delete Line" function.
 
If you want to delete a line that is repeated (that's what I'm guessing you'd
like to do), you could use the "Find & Replace" and leave the "Replace
with..." blank. I've never seen a "Delete line" function, but that would be
nice if the lines were numbered and you could type "Delete line # X" - would
make things a bit easier.
 
I would settle for a find/replace if find/replace would blank out a line.
Correct me if I'm wrong, but doesn't Find/Replace simply replace the "Find"
part of the line? So then I would just be putting a few blanks in my unwanted
line of text. I don't know what text the whole line would contain.
 
Yes, unfortunately you would have to type the entire line in the "Find" box.
It would be easier to "find" a few words you know are there and delete what
you need. If you have a large document to deal with, then this could become
very time consuming, but I'm not sure of any other way. Maybe someone who is
a "macro-wizard" could offer some advice.
 
Thanks for your response. I concur this is probably a macro and have posted
the question in the Word Programming group.
 
Back
Top