Word Search and Replace

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

Guest

Hi all,

Can anyone provide me with guidance.

I have a series of comma & space separated values in the format:-

542224452, 5422245#, 54222740, 54223425, 5422346, 542235, 54224140,
54224141#, 542244412, 542244413#, 542244414#, 542244415#, 542244416#,
542244417#, 542244418#.

I'd like use a find and replace function to find all the numbers ending in a
# and replace them with just the number (ie without the #) but in bold (or
another colour ie Red).

Any advice will be gratefully received.

Thanks in advance

Yandros
 
Use a wildcard replace of
([0-9]{1,})#
with
\1 (with format font > red colour & bold set)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
you can use a macro like this one (which only converts
one number)

Selection.Find.ClearFormatting
With Selection.Find
.Text = "#"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdWord, Count:=2,
Extend:=wdExtend
Selection.Font.Bold = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
 
Hi Graham,

Thank you very much. This definitely hits the spot. You've saved me a great
deal of time (can you imagine having to do this manually on a series which
contains some 1800 to 2000 values)!

I am very grateful. Thank again for taking the time and effort (and also
finding the solution so quickly too).

Graham Mayor said:
Use a wildcard replace of
([0-9]{1,})#
with
\1 (with format font > red colour & bold set)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Hi all,

Can anyone provide me with guidance.

I have a series of comma & space separated values in the format:-

542224452, 5422245#, 54222740, 54223425, 5422346, 542235, 54224140,
54224141#, 542244412, 542244413#, 542244414#, 542244415#, 542244416#,
542244417#, 542244418#.

I'd like use a find and replace function to find all the numbers
ending in a # and replace them with just the number (ie without the
#) but in bold (or another colour ie Red).

Any advice will be gratefully received.

Thanks in advance

Yandros
 
Hi Jesse,

I was really looking for a solution that would convert all the numbers (I
have a list of up 2000 to work through).

However, thank you for taking the time to help me solve the problem

Yandros
 
If you want to read the background, see
http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Hi Graham,

Thank you very much. This definitely hits the spot. You've saved me a
great deal of time (can you imagine having to do this manually on a
series which contains some 1800 to 2000 values)!

I am very grateful. Thank again for taking the time and effort (and
also finding the solution so quickly too).

Graham Mayor said:
Use a wildcard replace of
([0-9]{1,})#
with
\1 (with format font > red colour & bold set)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Hi all,

Can anyone provide me with guidance.

I have a series of comma & space separated values in the format:-

542224452, 5422245#, 54222740, 54223425, 5422346, 542235, 54224140,
54224141#, 542244412, 542244413#, 542244414#, 542244415#,
542244416#, 542244417#, 542244418#.

I'd like use a find and replace function to find all the numbers
ending in a # and replace them with just the number (ie without the
#) but in bold (or another colour ie Red).

Any advice will be gratefully received.

Thanks in advance

Yandros
 
Back
Top