Find and Replace

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?!
 
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
 
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,

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.

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



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 -
 
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!
 
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 said:
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 said:
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?!
 
Back
Top