A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Find and Replace



 
 
Thread Tools Display Modes
  #1  
Old February 25th, 2009, 05:33 PM posted to microsoft.public.word.newusers
Island Girl
external usenet poster
 
Posts: 227
Default Find and Replace

I have a 50 page document with names, addresses and phone numbers. The phone
numbers are not formatted as usual (for example, (954) 543-1800). Instead
they're just 10 numbers in a row (9545431800). I thought I had learned
enough from you to figure this out myself, but I'm stumbling.

Can you tell me how to change the phone numbers to this example: (954)
543-1800 with your find and replace wizardry?

Thanks so very, very much.
  #2  
Old February 25th, 2009, 06:40 PM posted to microsoft.public.word.newusers
Island Girl[_2_]
external usenet poster
 
Posts: 2
Default Find and Replace

You, my teachers, will be proud to know that I figured it out. Thanks for
making that possible!!!!!

"Island Girl" wrote:

I have a 50 page document with names, addresses and phone numbers. The phone
numbers are not formatted as usual (for example, (954) 543-1800). Instead
they're just 10 numbers in a row (9545431800). I thought I had learned
enough from you to figure this out myself, but I'm stumbling.

Can you tell me how to change the phone numbers to this example: (954)
543-1800 with your find and replace wizardry?

Thanks so very, very much.

  #3  
Old February 25th, 2009, 06:55 PM posted to microsoft.public.word.newusers
Greg Maxey[_2_]
external usenet poster
 
Posts: 649
Default Find and Replace

The answer depends on if the numbers are

1234567890

or

(1234567890)

Run one of the following two macors:


Option Explicit
Sub ScratchMacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Content
With oRng.Find
.Text = "[0-9]{10}"
.MatchWildcards = True
While .Execute
oRng.Text = "(" & Left(oRng.Text, 3) & ")-" & Mid(oRng.Text, 4, 3) & "-"
& Right(oRng.Text, 4)
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub

Sub ScratchMacroII()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Content
With oRng.Find
.Text = "\([0-9]{10}\)"
.MatchWildcards = True
While .Execute
oRng.Text = Left(oRng.Text, 4) & ")-" & Mid(oRng.Text, 5, 3) & "-" &
Mid(oRng.Text, 8, 4)
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub



Island Girl wrote:
I have a 50 page document with names, addresses and phone numbers.
The phone numbers are not formatted as usual (for example, (954)
543-1800). Instead they're just 10 numbers in a row (9545431800). I
thought I had learned enough from you to figure this out myself, but
I'm stumbling.

Can you tell me how to change the phone numbers to this example: (954)
543-1800 with your find and replace wizardry?

Thanks so very, very much.


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



  #4  
Old February 25th, 2009, 07:03 PM posted to microsoft.public.word.newusers
Greg Maxey[_2_]
external usenet poster
 
Posts: 649
Default Find and Replace

Or run one of these pairs in the Find and Replace with wildcards on:

(\([0-9]{3})([0-9]{3})([0-9]{4})(\))



\1)-\2-\3





([0-9]{3})([0-9]{3})([0-9]{4})



(\1)-\2-\3


Island Girl wrote:
I have a 50 page document with names, addresses and phone numbers.
The phone numbers are not formatted as usual (for example, (954)
543-1800). Instead they're just 10 numbers in a row (9545431800). I
thought I had learned enough from you to figure this out myself, but
I'm stumbling.

Can you tell me how to change the phone numbers to this example: (954)
543-1800 with your find and replace wizardry?

Thanks so very, very much.


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



  #5  
Old February 27th, 2009, 02:47 PM posted to microsoft.public.word.newusers
Island Girl
external usenet poster
 
Posts: 227
Default Find and Replace

Thanks, Greg, for your continued support and for teaching me so much. I'm
sorry to be so late in telling you that moments after my email to the group,
my "panic" disappeared and I figured it out, using the same pairs as below.
I just can't read enough about it, and I just can't thank you and your fellow
MVPs enough!

I've found the study of wildcards--to which you have contributed so much--to
be the most fascinating and perhaps the single most helpful thing in my work.
Keep those golden nuggets coming!

"Greg Maxey" wrote:

Or run one of these pairs in the Find and Replace with wildcards on:

(\([0-9]{3})([0-9]{3})([0-9]{4})(\))



\1)-\2-\3





([0-9]{3})([0-9]{3})([0-9]{4})



(\1)-\2-\3


Island Girl wrote:
I have a 50 page document with names, addresses and phone numbers.
The phone numbers are not formatted as usual (for example, (954)
543-1800). Instead they're just 10 numbers in a row (9545431800). I
thought I had learned enough from you to figure this out myself, but
I'm stumbling.

Can you tell me how to change the phone numbers to this example: (954)
543-1800 with your find and replace wizardry?

Thanks so very, very much.


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org




  #6  
Old March 1st, 2009, 11:28 AM posted to microsoft.public.word.newusers
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Find and Replace

For even more coverage of wildcards, see
http://www.gmayor.com/replace_using_wildcards.htm

--

Graham Mayor - Word MVP

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



Island Girl wrote:
Thanks, Greg, for your continued support and for teaching me so much.
I'm sorry to be so late in telling you that moments after my email to
the group, my "panic" disappeared and I figured it out, using the
same pairs as below. I just can't read enough about it, and I just
can't thank you and your fellow MVPs enough!

I've found the study of wildcards--to which you have contributed so
much--to be the most fascinating and perhaps the single most helpful
thing in my work. Keep those golden nuggets coming!

"Greg Maxey" wrote:

Or run one of these pairs in the Find and Replace with wildcards on:

(\([0-9]{3})([0-9]{3})([0-9]{4})(\))



\1)-\2-\3





([0-9]{3})([0-9]{3})([0-9]{4})



(\1)-\2-\3


Island Girl wrote:
I have a 50 page document with names, addresses and phone numbers.
The phone numbers are not formatted as usual (for example, (954)
543-1800). Instead they're just 10 numbers in a row (9545431800).
I thought I had learned enough from you to figure this out myself,
but I'm stumbling.

Can you tell me how to change the phone numbers to this example:
(954) 543-1800 with your find and replace wizardry?

Thanks so very, very much.


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



  #7  
Old March 2nd, 2009, 08:45 PM posted to microsoft.public.word.newusers
Island Girl
external usenet poster
 
Posts: 227
Default Find and Replace

That's exactly how I finally figured it out, Graham! It's my Find & Replace
Bible. I was stumbling at first--but the answer was so very simple after
putting into place what I'd learned from your article! Can't thank you
enough!

"Graham Mayor" wrote:

For even more coverage of wildcards, see
http://www.gmayor.com/replace_using_wildcards.htm

--

Graham Mayor - Word MVP

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



Island Girl wrote:
Thanks, Greg, for your continued support and for teaching me so much.
I'm sorry to be so late in telling you that moments after my email to
the group, my "panic" disappeared and I figured it out, using the
same pairs as below. I just can't read enough about it, and I just
can't thank you and your fellow MVPs enough!

I've found the study of wildcards--to which you have contributed so
much--to be the most fascinating and perhaps the single most helpful
thing in my work. Keep those golden nuggets coming!

"Greg Maxey" wrote:

Or run one of these pairs in the Find and Replace with wildcards on:

(\([0-9]{3})([0-9]{3})([0-9]{4})(\))



\1)-\2-\3





([0-9]{3})([0-9]{3})([0-9]{4})



(\1)-\2-\3


Island Girl wrote:
I have a 50 page document with names, addresses and phone numbers.
The phone numbers are not formatted as usual (for example, (954)
543-1800). Instead they're just 10 numbers in a row (9545431800).
I thought I had learned enough from you to figure this out myself,
but I'm stumbling.

Can you tell me how to change the phone numbers to this example:
(954) 543-1800 with your find and replace wizardry?

Thanks so very, very much.

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org




  #8  
Old March 3rd, 2009, 06:36 AM posted to microsoft.public.word.newusers
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Find and Replace

You are welcome

--

Graham Mayor - Word MVP

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



Island Girl wrote:
That's exactly how I finally figured it out, Graham! It's my Find &
Replace Bible. I was stumbling at first--but the answer was so very
simple after putting into place what I'd learned from your article!
Can't thank you enough!

"Graham Mayor" wrote:

For even more coverage of wildcards, see
http://www.gmayor.com/replace_using_wildcards.htm

--

Graham Mayor - Word MVP

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



Island Girl wrote:
Thanks, Greg, for your continued support and for teaching me so
much. I'm sorry to be so late in telling you that moments after my
email to the group, my "panic" disappeared and I figured it out,
using the same pairs as below. I just can't read enough about it,
and I just can't thank you and your fellow MVPs enough!

I've found the study of wildcards--to which you have contributed so
much--to be the most fascinating and perhaps the single most helpful
thing in my work. Keep those golden nuggets coming!

"Greg Maxey" wrote:

Or run one of these pairs in the Find and Replace with wildcards
on:

(\([0-9]{3})([0-9]{3})([0-9]{4})(\))



\1)-\2-\3





([0-9]{3})([0-9]{3})([0-9]{4})



(\1)-\2-\3


Island Girl wrote:
I have a 50 page document with names, addresses and phone numbers.
The phone numbers are not formatted as usual (for example, (954)
543-1800). Instead they're just 10 numbers in a row (9545431800).
I thought I had learned enough from you to figure this out myself,
but I'm stumbling.

Can you tell me how to change the phone numbers to this example:
(954) 543-1800 with your find and replace wizardry?

Thanks so very, very much.

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.