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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|