Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
change font color on search
Hi, I need to do a search and replace in a worksheet. When I match a string,
I want to change the color. For example, if the string is "Hello everyone!" I want to search for any word that starts and ends with 'e', then change the word color to be blue. Is this possible with a cell formula? Do I need a sheet macro? I cant seem to figure it out with either! Thanks in advance for any help! (Office 2003) |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
change font color on search
What you are asking cannot be done with formulas. Neither with
conditional formatting, because you want formatting at text and not cell level. The following marco will highlight the word srch in all cells in the range C1:D10 of Sheet1: Sub Highlight(srch As String) Dim dta As Range, c As Range Set dta = Sheets("Sheet1").Range("C1:D10") For Each c In dta If InStr(1, c.Value, srch) Then With c.Characters(Start:=InStr(1, c.Value, srch), Length:=Len(srch)).Font .ColorIndex = 41 End With End If Next c End Sub HTH Kostis Vezerides |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
change font color on search
No it doesn't
"vezerid" wrote: What you are asking cannot be done with formulas. Neither with conditional formatting, because you want formatting at text and not cell level. The following marco will highlight the word srch in all cells in the range C1:D10 of Sheet1: Sub Highlight(srch As String) Dim dta As Range, c As Range Set dta = Sheets("Sheet1").Range("C1:D10") For Each c In dta If InStr(1, c.Value, srch) Then With c.Characters(Start:=InStr(1, c.Value, srch), Length:=Len(srch)).Font .ColorIndex = 41 End With End If Next c End Sub HTH Kostis Vezerides |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can't change font | Excel Worksheet Functions | |||
Can't change cell value with unusual font. | Excel Worksheet Functions | |||
I can't change the font size in the printouts? | Excel Discussion (Misc queries) | |||
how do i change font kerning | Excel Discussion (Misc queries) | |||
How do I get the font color to change automatically depending on | Excel Discussion (Misc queries) |