Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default add colours to caracters

I would like to add different colours to different numbers in an excel sheet.

So for example "1234" should be green every time when these determined
caracters (numbers) appears on the sheet.
Can I do it? And if yes, can i match more determined caracters with
different coulours.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default add colours to caracters

Hi Sheva,
You can easily accomplish this through CONDITIONAL FORMATTING.
- Highlight the entire sheet (or column that will contain the number that
you are searching for)
- From the menu select FORMAT Conditional Format
- From the box select CELL VALUE IS EQUAL TO
- In the box beside that type in the value you are looking to highlight
- Press the FORMAT button and select the color that you wish to apply to
that number

If you want to look for and change the color of other numbers, then click on
ADD and repeat the above steps.

HTH
Tom

"sheva" wrote:

I would like to add different colours to different numbers in an excel sheet.

So for example "1234" should be green every time when these determined
caracters (numbers) appears on the sheet.
Can I do it? And if yes, can i match more determined caracters with
different coulours.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default add colours to caracters

Option Explicit

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Dim iPos As Long
Const TEST_VALUE_1 As String = "1234"
Const TEST_COLORINDEX_1 As Long = 10
Const TEST_VALUE_2 As String = "789"
Const TEST_COLORINDEX_2 As Long = 5

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
Select Case True
Case InStr(CStr(.Value), TEST_VALUE_1) 0:
.Characters(iPos, Len(TEST_VALUE_1)). _
Font.ColorIndex = TEST_COLORINDEX_1
Case InStr(CStr(.Value), TEST_VALUE_2) 0:
.Characters(iPos, Len(TEST_VALUE_2)). _
Font.ColorIndex = TEST_COLORINDEX_2
'etc.
End Select
End With

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

(remove xxx from email address if mailing direct)

"sheva" wrote in message
...
I would like to add different colours to different numbers in an excel

sheet.

So for example "1234" should be green every time when these determined
caracters (numbers) appears on the sheet.
Can I do it? And if yes, can i match more determined caracters with
different coulours.

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
how to extract caracters up to comma in excel cell jethan Excel Worksheet Functions 2 July 24th 08 01:54 PM
count the number of caracters in a cell Jan New Users to Excel 8 July 1st 06 01:10 AM
count the number of caracters in a cell Jan New Users to Excel 2 June 30th 06 09:32 PM
Increase Fotter Caracters LoveCandle[_22_] Excel Programming 0 November 25th 05 06:58 AM
Can you Limit the number of caracters that can be typed in a cell? pepperjack[_3_] Excel Programming 3 August 29th 04 03:19 AM


All times are GMT +1. The time now is 10:48 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"