LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Cell Colours

Correct, you'll need to use VB. But we'll try to help you out. ;-)
First, right click on your sheet tab, view code. Paste the following in:

'=======
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
'Define the range you want conditioned
For Each cell In Range("B:B")
x = cell.Value
Select Case x

'Copy this style as needed
Case "Bob"
cell.Interior.ColorIndex = 1
Case "Tom"
cell.Interior.ColorIndex = 2
Case "Smith"
cell.Interior.ColorIndex = 3
'If you want to modify font, use following format:
cell.Font.ColorIndex = 1

End Select
Next cell
Application.EnableEvents = True
End Sub
'===========


You'll notice the part at the beginning where you define the range you want
to look at. Set this up to include the cells your want "formatted".

Also, the section with the various cases is where you setup your different
scenarios. The last case has an example of how to define font color. Note
that colors are deifned via numbers, not by words. If you need to create a
"key" to help you know which colors go with which numbers, you can run the
following macro:

'=======
Sub CreateReference()
For i = 1 To 56
Cells(i, 1).Interior.ColorIndex = 1
Next
End Sub
'=======

Once you're done editing your macro, close the Visual Basic Editor, and
continue as normal in your workbook.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Eddiec" wrote:

I have been trying to find an answer to my question for months, but to no
avail.

I need to change the colours of cells based on different words I type in.
For example "Deployed" = Red Cell, "Awaiting" = Blue Cell etc... Everywhere I
look people say use Conditional Formatting, however, this only allows three
changes and I have a minimum of 10. From what I can gather I need to program
some VB but unfortunately VB may as well be "Klingon".

I guess what I am asking is - could anyone provide a quick VB script that
could allow me to do what I need?

Pleeeeeeeeeeez help

 
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 save one of the MORE COLOURS in the THEME COLOURS? Wulfy Excel Discussion (Misc queries) 0 August 18th 09 10:25 AM
Cell Colours jmc Excel Discussion (Misc queries) 1 June 16th 07 03:06 PM
how do i get more colours for cell shading Trev Ellis Excel Discussion (Misc queries) 2 August 3rd 05 12:52 PM
Excel 2003 font colours and cell colours bretta Excel Discussion (Misc queries) 1 April 17th 05 03:45 AM
How to set different font colours in a cell? Sam Excel Worksheet Functions 1 March 29th 05 01:53 AM


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