Hi,
I need help with structuring the code to format only numbers inside a string (code) to red. I have use ^# in the find box and RED formatting in the replace box, but Word shades the entire word/string in red, not just the numbers.
If I have a list of entries similar to this:
ABC123Z
A148Z
BACX12
RSM1Z
AA1234Z
...
I would like only the numerical character to be coloured in red within the string which is currently black text.
I found this information: http://word.mvps.org/faqs/general/Using ... m#Example6 (Example 6 in the page), but I have little clue as to what Tags are and how to make sense of it.
TX for any assistance.
Format ONLY numbers in a string to RED
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Format ONLY numbers in a string to RED
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Format ONLY numbers in a string to RED
Make sure that you click More >> and tick the check box 'Use wildcards' in the Replace dialog (Ctrl+H).
Enter the following in the 'Find what' box:
[0-9]{1,}
[0-9] means any of the characters 0 to 9, i.e. any digit, and {1,} means one or more of the previous.
For others reading this: if your system uses comma as decimal separator, use {1;} instead of {1,}.
Click Format > Font... and select red from the color dropdown, then click OK.
Enter the following in the 'Replace with' box:
^&
This is the code for 'whatever was found'.
Click 'Replace All'.
Enter the following in the 'Find what' box:
[0-9]{1,}
[0-9] means any of the characters 0 to 9, i.e. any digit, and {1,} means one or more of the previous.
For others reading this: if your system uses comma as decimal separator, use {1;} instead of {1,}.
Click Format > Font... and select red from the color dropdown, then click OK.
Enter the following in the 'Replace with' box:
^&
This is the code for 'whatever was found'.
Click 'Replace All'.
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Format ONLY numbers in a string to RED
Works perfectly...
TX.
TX.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.