View Single Post
  #11   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Automating color on specific text.

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


G-Artist wrote:
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" wrote in message
...
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
Word MVP web site http://word.mvps.org


G-Artist wrote:
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" wrote in message
...
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
Word MVP web site http://word.mvps.org




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.


"G-Artist" wrote in message
k.net...

"Graham Mayor" wrote in message
...
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
Word MVP web site http://word.mvps.org




G-Artist wrote:
"Suzanne S. Barnhill" wrote in message
...
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
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to
the newsgroup so all may benefit.

"G-Artist" wrote in message
nk.net...
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.