Automating color on specific text.

G

G-Artist

Hi,

I have many lists of numbers typed into a Word 2000 document.
Each specific number needs to be one of 3 colors (Red, Black
or Green). So, what I what I would like to do is find a way to
use something like a "search and replace" to alter some of
the current numbers, which are all Black, and change them to
either Red or Green depending on the specific number.

Very, very tedious to do them by hand.

E.g. 1 2 3 4 5 6 - the 1, 3, 5 need to be red.

Doable? How?


Thanks.
 
S

Suzanne S. Barnhill

You can use Find and Replace to change the font color. Using wildcards, you
can do more than one number at a time.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

G-Artist

Suzanne S. Barnhill said:
You can use Find and Replace to change the font color. Using wildcards, you
can do more than one number at a time.

Thanks for the reply. Could you be a bit more specific as to how
that is done? I don't seem to see a color option among the ones
shown.
 
G

G-Artist

Graham Mayor said:
In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.
 
S

Suzanne S. Barnhill

It works here. Make sure that the insertion point is in the "Replace with"
box when you format the font color as red. The bug that bites me every time
is that, even though you have the insertion point there when you click More,
it jumps back to "Find what," and you end up applying the font formatting to
"Find what" instead.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

G-Artist said:
In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.

See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

Also it won't find anything to change if the Use wildcards checkbox is not
checked!

If you prefer, the following macro will do the same job:

Sub OneThreeFive_to_red()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[135]{1}"
.Replacement.Text = "^&"
.Replacement.Font.Color = wdColorRed
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

see http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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


It works here. Make sure that the insertion point is in the "Replace
with" box when you format the font color as red. The bug that bites
me every time is that, even though you have the insertion point there
when you click More, it jumps back to "Find what," and you end up
applying the font formatting to "Find what" instead.


G-Artist said:
In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.

See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

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



G-Artist wrote:
You can use Find and Replace to change the font color. Using
wildcards, you can do more than one number at a time.

Thanks for the reply. Could you be a bit more specific as to how
that is done? I don't seem to see a color option among the ones
shown.


Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Hi,

I have many lists of numbers typed into a Word 2000 document.
Each specific number needs to be one of 3 colors (Red, Black
or Green). So, what I what I would like to do is find a way to
use something like a "search and replace" to alter some of
the current numbers, which are all Black, and change them to
either Red or Green depending on the specific number.

Very, very tedious to do them by hand.

E.g. 1 2 3 4 5 6 - the 1, 3, 5 need to be red.

Doable? How?


Thanks.
 
G

G-Artist

WOW!!! Thanks, Graham. The macro works.

Now for the $64 question.... how do I not make the number
10 11 15 17 etc. turn red or partially red?

My list goes from 1-36
1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36
need to be red but the rest stay the default black.

Graham Mayor said:
Also it won't find anything to change if the Use wildcards checkbox is not
checked!

If you prefer, the following macro will do the same job:

Sub OneThreeFive_to_red()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[135]{1}"
.Replacement.Text = "^&"
.Replacement.Font.Color = wdColorRed
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

see http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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


It works here. Make sure that the insertion point is in the "Replace
with" box when you format the font color as red. The bug that bites
me every time is that, even though you have the insertion point there
when you click More, it jumps back to "Find what," and you end up
applying the font formatting to "Find what" instead.


G-Artist said:
In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.


See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

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



G-Artist wrote:
You can use Find and Replace to change the font color. Using
wildcards, you can do more than one number at a time.

Thanks for the reply. Could you be a bit more specific as to how
that is done? I don't seem to see a color option among the ones
shown.


Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Hi,

I have many lists of numbers typed into a Word 2000 document.
Each specific number needs to be one of 3 colors (Red, Black
or Green). So, what I what I would like to do is find a way to
use something like a "search and replace" to alter some of
the current numbers, which are all Black, and change them to
either Red or Green depending on the specific number.

Very, very tedious to do them by hand.

E.g. 1 2 3 4 5 6 - the 1, 3, 5 need to be red.

Doable? How?


Thanks.
 
G

Graham Mayor

I though that might happen - try plan B

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("1", "3", "5", "7", "9", "12", _
"14", "16", "18", "19", "21", "23", _
"25", "27", "30", "32", "34", "36")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Font.Color = wdColorRed
.Execute replace:=wdReplaceAll
Next i
End With
End Sub


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

My web site www.gmayor.com

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

G-Artist said:
WOW!!! Thanks, Graham. The macro works.

Now for the $64 question.... how do I not make the number
10 11 15 17 etc. turn red or partially red?

My list goes from 1-36
1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36
need to be red but the rest stay the default black.

Graham Mayor said:
Also it won't find anything to change if the Use wildcards checkbox
is not checked!

If you prefer, the following macro will do the same job:

Sub OneThreeFive_to_red()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[135]{1}"
.Replacement.Text = "^&"
.Replacement.Font.Color = wdColorRed
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

see http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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


It works here. Make sure that the insertion point is in the "Replace
with" box when you format the font color as red. The bug that bites
me every time is that, even though you have the insertion point
there when you click More, it jumps back to "Find what," and you
end up applying the font formatting to "Find what" instead.



In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.


See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

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



G-Artist wrote:
You can use Find and Replace to change the font color. Using
wildcards, you can do more than one number at a time.

Thanks for the reply. Could you be a bit more specific as to how
that is done? I don't seem to see a color option among the ones
shown.


Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Hi,

I have many lists of numbers typed into a Word 2000 document.
Each specific number needs to be one of 3 colors (Red, Black
or Green). So, what I what I would like to do is find a way to
use something like a "search and replace" to alter some of
the current numbers, which are all Black, and change them to
either Red or Green depending on the specific number.

Very, very tedious to do them by hand.

E.g. 1 2 3 4 5 6 - the 1, 3, 5 need to be red.

Doable? How?


Thanks.
 
G

G-Artist

Plan B works so very excellently!!!

Thank you ever so much.

It is enough of a pain to have to type in hundreds of numbers
but then manually (and w/o making a mistake) to have
to color them properly is a serious chore.

I really do appreciate the assistance.

Graham Mayor said:
I though that might happen - try plan B

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("1", "3", "5", "7", "9", "12", _
"14", "16", "18", "19", "21", "23", _
"25", "27", "30", "32", "34", "36")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Font.Color = wdColorRed
.Execute replace:=wdReplaceAll
Next i
End With
End Sub


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

My web site www.gmayor.com

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

G-Artist said:
WOW!!! Thanks, Graham. The macro works.

Now for the $64 question.... how do I not make the number
10 11 15 17 etc. turn red or partially red?

My list goes from 1-36
1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36
need to be red but the rest stay the default black.

Graham Mayor said:
Also it won't find anything to change if the Use wildcards checkbox
is not checked!

If you prefer, the following macro will do the same job:

Sub OneThreeFive_to_red()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[135]{1}"
.Replacement.Text = "^&"
.Replacement.Font.Color = wdColorRed
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

see http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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



Suzanne S. Barnhill wrote:
It works here. Make sure that the insertion point is in the "Replace
with" box when you format the font color as red. The bug that bites
me every time is that, even though you have the insertion point
there when you click More, it jumps back to "Find what," and you
end up applying the font formatting to "Find what" instead.



In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.


See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

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



G-Artist wrote:
You can use Find and Replace to change the font color. Using
wildcards, you can do more than one number at a time.

Thanks for the reply. Could you be a bit more specific as to how
that is done? I don't seem to see a color option among the ones
shown.


Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Hi,

I have many lists of numbers typed into a Word 2000 document.
Each specific number needs to be one of 3 colors (Red, Black
or Green). So, what I what I would like to do is find a way to
use something like a "search and replace" to alter some of
the current numbers, which are all Black, and change them to
either Red or Green depending on the specific number.

Very, very tedious to do them by hand.

E.g. 1 2 3 4 5 6 - the 1, 3, 5 need to be red.

Doable? How?


Thanks.
 
G

Graham Mayor

You are welcome

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

My web site www.gmayor.com

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

G-Artist said:
Plan B works so very excellently!!!

Thank you ever so much.

It is enough of a pain to have to type in hundreds of numbers
but then manually (and w/o making a mistake) to have
to color them properly is a serious chore.

I really do appreciate the assistance.

Graham Mayor said:
I though that might happen - try plan B

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("1", "3", "5", "7", "9", "12", _
"14", "16", "18", "19", "21", "23", _
"25", "27", "30", "32", "34", "36")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Font.Color = wdColorRed
.Execute replace:=wdReplaceAll
Next i
End With
End Sub


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

My web site www.gmayor.com

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

G-Artist said:
WOW!!! Thanks, Graham. The macro works.

Now for the $64 question.... how do I not make the number
10 11 15 17 etc. turn red or partially red?

My list goes from 1-36
1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36
need to be red but the rest stay the default black.

Also it won't find anything to change if the Use wildcards checkbox
is not checked!

If you prefer, the following macro will do the same job:

Sub OneThreeFive_to_red()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[135]{1}"
.Replacement.Text = "^&"
.Replacement.Font.Color = wdColorRed
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

see http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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



Suzanne S. Barnhill wrote:
It works here. Make sure that the insertion point is in the
"Replace with" box when you format the font color as red. The bug
that bites me every time is that, even though you have the
insertion point there when you click More, it jumps back to "Find
what," and you end up applying the font formatting to "Find what"
instead.



In the find box put
[135]{1}
in the replace box put
^&
Click the 'More' button
With your cursor in the replace box
Format > font > and check the colour as red
Check the 'Use wildcards' box

I did it all as you laid it out. Nothing gets changed.


See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

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



G-Artist wrote:
You can use Find and Replace to change the font color. Using
wildcards, you can do more than one number at a time.

Thanks for the reply. Could you be a bit more specific as to
how that is done? I don't seem to see a color option among
the ones shown.


Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to
the newsgroup so all may benefit.

Hi,

I have many lists of numbers typed into a Word 2000 document.
Each specific number needs to be one of 3 colors (Red, Black
or Green). So, what I what I would like to do is find a way
to use something like a "search and replace" to alter some of
the current numbers, which are all Black, and change them to
either Red or Green depending on the specific number.

Very, very tedious to do them by hand.

E.g. 1 2 3 4 5 6 - the 1, 3, 5 need to be red.

Doable? How?


Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top