Reply
 
Thread Tools Display Modes
  #1   Report Post  
Janis Anna
 
Posts: n/a
Default Find and Replace: delete a line & find a number 10

TWO THINGS

#1 - I have a list that looks like the list below....

able: 1
about: 18
above: 1
accompany: 1
across: 3
actually: 2
adoring: 1

I want Find and Replace to automatically delete each line that equals ":
1"... (i.e.: delete the lines "able: 1" and "above: 1" and "adoring: 1") the
whole line... I cannot seem to get past this - (a): 1


#2 - I want Find any number over 20 (i.e.: 20) Or a range of numbers (i.e.:
20 & 40)


Can anyone help?

  #2   Report Post  
Greg Maxey
 
Posts: n/a
Default Find and Replace: delete a line & find a number 10

Janis,

Provided that each line in the list is an individual paragraph then yuo
could use a macro something like this:

Sub ScratchMacro1()
Dim oPara As Paragraph
Dim oRng As Range
For Each oPara In ActiveDocument.Range.Paragraphs
If InStr(oPara.Range.Text, ": 1" & Chr$(13)) Then
oPara.Range.Delete
End If
Next
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = ": [0-9]{2,}"
.Wrap = wdFindStop
.MatchWildcards = True
While .Execute
If Right(oRng, 2) 20 And Right(oRng, 2) 40 Then
oRng.Font.Color = wdColorBlue
oRng.Collapse Direction:=wdCollapseEnd
End If
Wend
End With
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Janis Anna wrote:
TWO THINGS

#1 - I have a list that looks like the list below....

able: 1
about: 18
above: 1
accompany: 1
across: 3
actually: 2
adoring: 1

I want Find and Replace to automatically delete each line that equals
": 1"... (i.e.: delete the lines "able: 1" and "above: 1" and
"adoring: 1") the whole line... I cannot seem to get past this -
(a): 1


#2 - I want Find any number over 20 (i.e.: 20) Or a range of numbers
(i.e.:
20 & 40)


Can anyone help?



  #3   Report Post  
Jezebel
 
Posts: n/a
Default Find and Replace: delete a line & find a number 10

#1. With 'Use wildcards' checked, search for [a-z]@: 1^013 and replace with
nothing

#2. This is trickier. Bear in mind that you are matching strings of digits,
not numbers as such. You could use: [2-9][0-9] for 20 to 99, then
[1-9][0-9]{2,} for 100 onwards. Can't answer about your number ranges
without knowing what they look like.


An alternative approach is to put your list into Excel, using ": " as the
column delimiter. Then it's easy to sort on the number and delete (or
whatever) the rows you don't want. Come to think of it, you could do that in
Word also: replace ": " with tab, then select all and convert text to table,
then sort on column 2.





"Janis Anna" Janis wrote in message
...
TWO THINGS

#1 - I have a list that looks like the list below....

able: 1
about: 18
above: 1
accompany: 1
across: 3
actually: 2
adoring: 1

I want Find and Replace to automatically delete each line that equals ":
1"... (i.e.: delete the lines "able: 1" and "above: 1" and "adoring: 1")
the
whole line... I cannot seem to get past this - (a): 1


#2 - I want Find any number over 20 (i.e.: 20) Or a range of numbers
(i.e.:
20 & 40)


Can anyone help?



  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default Find and Replace: delete a line & find a number 10

You alrady have the answers, but see
http://www.gmayor.com/replace_using_wildcards.htm for the background.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Janis Anna wrote:
TWO THINGS

#1 - I have a list that looks like the list below....

able: 1
about: 18
above: 1
accompany: 1
across: 3
actually: 2
adoring: 1

I want Find and Replace to automatically delete each line that equals
": 1"... (i.e.: delete the lines "able: 1" and "above: 1" and
"adoring: 1") the whole line... I cannot seem to get past this -
(a): 1


#2 - I want Find any number over 20 (i.e.: 20) Or a range of numbers
(i.e.:
20 & 40)


Can anyone help?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find and replace a number range in MS Word Chappy Microsoft Word Help 4 October 3rd 05 06:28 AM
Find and replace manual line breaks Orrie Microsoft Word Help 7 February 9th 05 08:40 AM
find, block - goto replace or delete Brent Hauver Formatting Long Documents 1 February 4th 05 09:46 PM
How do I find and replace a superscript number in a word? Steve Starling Microsoft Word Help 2 January 28th 05 05:38 AM
Find and Replace anomaly BruceM Microsoft Word Help 7 January 18th 05 06:47 PM


All times are GMT +1. The time now is 02:00 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"