View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default create a formula to produce a color in excel

Those are 6 out of the 56 default colors available in Excel

There are lighter colors.

To see a list of the colors and index numbers visit David McRitchie's site

http://www.mvps.org/dmcritchie/excel/colors.htm


Gord

On Wed, 28 Nov 2007 16:54:01 -0800, Senie
wrote:

It worked, YES! Are there other colors available? These colors are dark.

"Gord Dibben" wrote:

I like your attitude about the learning adventure. Keep it up.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("D:D"))
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case UCase(rng.Value)
Case Is = "A": Num = 10 'green
Case Is = "B": Num = 1 'black
Case Is = "C": Num = 5 'blue
Case Is = "D": Num = 7 'magenta
Case Is = "E": Num = 46 'orange
Case Is = "F": Num = 3 'red
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub

Right-click on your sheet tab and "View Code".

Copy/paste the code into that module.

Adjust Range("D:D") to suit


Gord

On Wed, 28 Nov 2007 11:00:02 -0800, Senie
wrote:

Sure go ahead and give me the information to use sheet event code which you
can supply. It will be a learning adventure for me.

I am also going to check out the website you have listed as well.
Thank you so much!

"Gord Dibben" wrote:

How many letters are you talking about?

Using CF as Max points out you can get 3.

If more you can download Bob Phillips' CFPlus which allows for 30

http://www.xldynamic.com/source/xld.....Download.html

Or use sheet event code which I can supply if you want to go that direction.


Gord Dibben MS Excel MVP

On Wed, 28 Nov 2007 07:58:01 -0800, Senie
wrote:

I am trying to produce a formula as to where I key in a specific letter and
the cell will turn to a specific color. for example: if I type in the Letter
"A" the cell the letter is typed in will turn to the color Light Blue.