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

Hi Kate,

I have written you a program to help you out. You will need to paste this
into a module in the Visual Basic Editor. Press <Alt-F11 to open the VB
Editor, go to View Project Explorer (don't worry if nothing happens because
maybe you can already see it), then look for a project called "VBAProject
(YourWorkbookName)". Right click on this and do Insert Module. You will
see a blank page on the right hand side. Copy the text below and paste it in
there.

Sub Kate()
For x = 1 To 550
If Cells(x, 3).Value = "cds" Then Cells(x, 3).Font.ColorIndex = 5
If Cells(x, 3).Value = "vgh" Then Cells(x, 3).Font.ColorIndex = 5
If Cells(x, 3).Value = "bn" Then Cells(x, 3).Font.ColorIndex = 3
If Cells(x, 3).Value = "cda" Then Cells(x, 3).Font.ColorIndex = 3
If Cells(x, 3).Value = "khg" Then Cells(x, 3).Font.ColorIndex = 45
Next x
End Sub

Now go back to the excel window and do Tools Macro Macros and do the one
called Kate.

I think you will see quite easily how to modify the code above to give you
what you need. You can add more conditions in there if you want just by
copying the lines. If you want to change the fill on the cells instead of
the font colour, use the word Interior instead of the word Font.

Here is another program you can use in the same way which will just give you
the numbers you need for each of the main colours, in case you want to choose
other ones.

Sub colourfinder()
Dim x As Integer, writerow As Integer, writecol As Integer
x = 1
writerow = 1
writecol = 1
Do Until x = 57
For writecol = 1 To 8
Cells(writerow, writecol).Value = x
Cells(writerow, writecol).Interior.ColorIndex = x
x = x + 1
Next writecol
writerow = writerow + 1
Loop
End Sub

--
Allllen


"kate" wrote:

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 08:22 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"