LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default conditional formatting text


'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H1:H10" '<==== change to suit

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value
Case "cds": .Interior.ColorIndex = 5 'blue
Case "vgh": .Interior.ColorIndex = 5 'blue
Case "cda": .Interior.ColorIndex = 46 'orange
Case "khg": .Interior.ColorIndex = 46 'orange
Case "bn": .Interior.ColorIndex = 3 'red
'etc.
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kate" wrote in message
...
Could you please help me?
I am trying to format text to highlight different colours depending on

code
e.g

cds (I would like to be blue) and vgh ( I would like to be blue)
bn (I would like to be red)
cda ( I would like to be orange) and khg (I would like to be orange)

and so on...
The data range is c1:c550 with various names
hope you can help thankyou Kate





 
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
Conditional Formatting when inserting a row zahoulik Excel Worksheet Functions 2 January 7th 06 03:01 PM
Conditional formatting : amount of decimals belgian11 Excel Discussion (Misc queries) 0 December 25th 05 04:47 PM
Formulas dealing with text data Bagia Excel Worksheet Functions 6 June 20th 05 10:29 PM
How do I apply conditional formatting to a text box barneshere Excel Worksheet Functions 1 May 27th 05 06:26 PM
Conditional Formatting based on Text within Text George Lynch Excel Discussion (Misc queries) 3 May 5th 05 07:58 PM


All times are GMT +1. The time now is 04:49 PM.

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"