View Single Post
  #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?