Hi all,
Currently, I'm using the following macro to delete numbers from a document.
Code:
Sub Macro111112()
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[0-9]{1,2}"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End Sub
Below is a sample of the information in the document.
Start here:
42
The foundation is built on the
43
now this is what is this is this
interesting here
44
ok if you look at age 39 you see formula
at the top
45
the vertebrae one of the segments of the
spinal column there are 33 vertebra and
46
End Here:
Therefore, this macro will delete all the numbers in the document.
My goal is to be able, with your help, to only delete the numbers outside the text. For example, after number 44, you see the following text: "ok if you look at age 39 you see formula at the top".
Basically, I want the macro to delete numbers 42,43,44,45 and 46 but not number 39 or 33, which is within the sentence or line.
Hope this is not confusing.
Thanks!!!