Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to find and replace a number range in MS Word | Microsoft Word Help | |||
Find and replace manual line breaks | Microsoft Word Help | |||
find, block - goto replace or delete | Formatting Long Documents | |||
How do I find and replace a superscript number in a word? | Microsoft Word Help | |||
Find and Replace anomaly | Microsoft Word Help |