![]() |
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. |
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. |
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. . |
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. |
All times are GMT +1. The time now is 01:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com