Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 383
Default Custom Format font for "xx" to yellow

can I Custom Format just the characters: xx to be a yellow font? thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Custom Format font for "xx" to yellow

Not possible using formatting


--
Regards,

Peo Sjoblom



"nastech" wrote in message
...
can I Custom Format just the characters: xx to be a yellow font? thanks



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Custom Format font for "xx" to yellow

You could use a macro.

Sub Color_String()
Dim Rng As Range
Dim cell As Range
Dim start_str As Integer
Set Rng = Selection
For Each cell In Rng
start_str = InStr(cell.Value, "xx")
If start_str Then
cell.Characters(start_str, 2).Font.ColorIndex = 6
End If
Next
End Sub

Or make it a worksheet event. Paste into the sheet module.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Dim Rng As Range
Dim cell As Range
Dim start_str As Integer
For Each cell In Target
start_str = InStr(cell.Value, "xx")
If start_str Then
cell.Characters(start_str, 2).Font.ColorIndex = 6
End If
Next
End If
ws_exit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
On Mon, 9 Jul 2007 12:06:04 -0700, nastech
wrote:

can I Custom Format just the characters: xx to be a yellow font? thanks


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
Custom Format xx="" nastech Excel Discussion (Misc queries) 1 July 8th 07 10:28 PM
Scroll Bar missing "Control" tab in "Format Properties" dialog box Peter Rooney Excel Discussion (Misc queries) 5 August 24th 06 05:36 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
custom format cell, if value is 0, then write "-" Toto Sanderson Excel Discussion (Misc queries) 4 February 24th 06 03:06 PM
Any IF(A2=font color=red", "1", "0") in excel? Or a way to do it? Steve Excel Discussion (Misc queries) 1 November 7th 05 02:48 PM


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

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

About Us

"It's about Microsoft Excel"