How do I change 6 digit field, cols 1 thru 6 to one (1) blank?

B

Bentley_the_cat

How do I change a 6 digit field in columns 1 thru 6 to one (1) blank or null?
It's an 80 character record with random 6 digit numbers in the first 6
positions that I need to delete and file is too big to do by hand.

Any Ideas?

thanks,
Bentley
 
D

Doug Robbins - Word MVP

Assuming that each record is a separate paragraph, a macro containing the
following code will do it:

Dim i As Long
Dim frange As Range
With ActiveDocument
For i = 1 To .Paragraphs.Count
Set frange = .Paragraphs(i).Range
frange.End = frange.Start + 6
frange.Delete
Next i
End With

Or using a Wildcard replace with

^13[0-9]{6}

in the Find what control and

^p

in the replace with control will do what you want for all but the first
record in the document

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top