Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Text color in cell

Any way to make one word in a cell RED with all other words black?

I am programming a macro and want one word to stand out from the others.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Text color in cell

You can try this
It will make the first 5 Characters red

Range("A1").Characters(Start:=1, Length:=5).Font.Color = vbRed


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Excel" wrote in message om...
Any way to make one word in a cell RED with all other words black?

I am programming a macro and want one word to stand out from the others.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Text color in cell

One way to do it, if you know the start position and the
length of the word is:
ActiveCell.Character(Start:=1,Length:=2).Font.Colo rIndex=3


-----Original Message-----
Any way to make one word in a cell RED with all other

words black?

I am programming a macro and want one word to stand out

from the others.
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Text color in cell

Manually. Yes. Select the word in Edit mode and select the Red font.

Programmatically, more difficult. Use the Instr Function to find the
start of the string, assuming that there is only one instance of the
word in the cell.

Knowing the starting position and length of the word, ........

Watch the line wrap.

Sub ColorMe()

Dim lngStart As Long

lngStart = InStr(1, ActiveCell.Value, "Word")
ActiveCell.Characters(Start:=lngStart, _
Length:=Len("Word")).Font.ColorIndex = 3

End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Any way to make one word in a cell RED with all other words black?

I am programming a macro and want one word to stand out from the others.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I fill one cell color with text html/rgb color from another thewris Excel Discussion (Misc queries) 2 January 22nd 09 12:24 AM
Can't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 01:41 PM
Make text color match cell color with macro? JoeSpareBedroom Excel Discussion (Misc queries) 1 June 26th 07 07:09 PM
Cell Fill Color and text color - changes for recipient Shadowman13 Excel Discussion (Misc queries) 0 March 8th 06 11:32 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM


All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"