Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
Find and Replace
I'm working on a document which contains a table, one column of which has
dates in the mm/dd/yy format. However, several pages of the table contain, for example, 6/25/07 instead of 06/25/07. What find and replace entry would result in placing a zero in front of the months with the inconsistent format? I've got a feeling this entry would use the "but not" feature, which somehow still throws me for a loop. What would I do without you?! |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
Find and Replace
IG,
I suppose it could be done with find and replace, but an easy way doesn't come to mind. Try running this macro with the table selected: Sub ScratchMacro() Dim oCell As Cell For Each oCell In Selection.Tables(1).Range.Cells If InStr(Left(oCell.Range.Text, 2), "/") Then oCell.Range.InsertBefore "0" End If Next End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Island Girl wrote: I'm working on a document which contains a table, one column of which has dates in the mm/dd/yy format. However, several pages of the table contain, for example, 6/25/07 instead of 06/25/07. What find and replace entry would result in placing a zero in front of the months with the inconsistent format? I've got a feeling this entry would use the "but not" feature, which somehow still throws me for a loop. What would I do without you?! |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
Find and Replace
If the macro approach can't be used for some reason, The following
find/replace specification seems to work (this one assumes that all years are 07; if they're all 0{something}, then replace 07 with 0[0-9]: Find what: ([!0])([1-9]/[0-9][0-9]/07) Replace with: \10\2 Make sure that Use wildcards is checked. -- Herb Tyson MS MVP http://www.herbtyson.com Author of the Word 2007 Bible Please respond in the newsgroups so everyone can follow along. "Island Girl" wrote in message ... I'm working on a document which contains a table, one column of which has dates in the mm/dd/yy format. However, several pages of the table contain, for example, 6/25/07 instead of 06/25/07. What find and replace entry would result in placing a zero in front of the months with the inconsistent format? I've got a feeling this entry would use the "but not" feature, which somehow still throws me for a loop. What would I do without you?! |
#4
Posted to microsoft.public.word.newusers
|
|||
|
|||
Find and Replace
Herb,
I tried that (or something close) before posting the macro. It won't work, for me at least, if the date is first text element of the cell range. On Feb 27, 10:28 pm, "Herb Tyson [MVP]" wrote: If the macro approach can't be used for some reason, The following find/replace specification seems to work (this one assumes that all years are 07; if they're all 0{something}, then replace 07 with 0[0-9]: Find what: ([!0])([1-9]/[0-9][0-9]/07) Replace with: \10\2 Make sure that Use wildcards is checked. -- Herb Tyson MS MVPhttp://www.herbtyson.com Author of the Word 2007 Bible Please respond in the newsgroups so everyone can follow along."Island Girl" wrote in message ... I'm working on a document which contains a table, one column of which has dates in the mm/dd/yy format. However, several pages of the table contain, for example, 6/25/07 instead of 06/25/07. What find and replace entry would result in placing a zero in front of the months with the inconsistent format? I've got a feeling this entry would use the "but not" feature, which somehow still throws me for a loop. What would I do without you?!- Hide quoted text - - Show quoted text - |
#5
Posted to microsoft.public.word.newusers
|
|||
|
|||
Find and Replace
Hi, Greg:
Thanks so very much for your quick reply with a solution to my problem. I can't believe that I now have two solutions to a problem for which I was beginning to think there was none! I read with glee both yours and Herb's, which also worked for me. Thanks for all you do, Greg! "Greg Maxey" wrote: IG, I suppose it could be done with find and replace, but an easy way doesn't come to mind. Try running this macro with the table selected: Sub ScratchMacro() Dim oCell As Cell For Each oCell In Selection.Tables(1).Range.Cells If InStr(Left(oCell.Range.Text, 2), "/") Then oCell.Range.InsertBefore "0" End If Next End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Island Girl wrote: I'm working on a document which contains a table, one column of which has dates in the mm/dd/yy format. However, several pages of the table contain, for example, 6/25/07 instead of 06/25/07. What find and replace entry would result in placing a zero in front of the months with the inconsistent format? I've got a feeling this entry would use the "but not" feature, which somehow still throws me for a loop. What would I do without you?! |
#6
Posted to microsoft.public.word.newusers
|
|||
|
|||
Find and Replace
Hi, Herb:
I really appreciate your answer to my perplexing problem. It worked for me the very first time! Thanks to you and Greg, I now have two valuable solutions to my problem. Thanks again, Herb! "Herb Tyson [MVP]" wrote: If the macro approach can't be used for some reason, The following find/replace specification seems to work (this one assumes that all years are 07; if they're all 0{something}, then replace 07 with 0[0-9]: Find what: ([!0])([1-9]/[0-9][0-9]/07) Replace with: \10\2 Make sure that Use wildcards is checked. -- Herb Tyson MS MVP http://www.herbtyson.com Author of the Word 2007 Bible Please respond in the newsgroups so everyone can follow along. "Island Girl" wrote in message ... I'm working on a document which contains a table, one column of which has dates in the mm/dd/yy format. However, several pages of the table contain, for example, 6/25/07 instead of 06/25/07. What find and replace entry would result in placing a zero in front of the months with the inconsistent format? I've got a feeling this entry would use the "but not" feature, which somehow still throws me for a loop. What would I do without you?! |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find multiple characters in one find using MSword find/replace | Microsoft Word Help | |||
How to Find a 'Printing' Paragraph symbol using 'Find & Replace' | Microsoft Word Help | |||
Trying to replace words with fields using Find/Replace | Microsoft Word Help | |||
Using find and replace or macros to replace page ranges | Microsoft Word Help | |||
Find/ Replace is auto-capping the words I want to replace with | Microsoft Word Help |