'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H1:H10"
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 1: .Interior.ColorIndex = 3 'red
Case 2: .Interior.ColorIndex = 6 'yellow
Case 3: .Interior.ColorIndex = 5 'blue
Case 4: .Interior.ColorIndex = 10 'green
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)
"phrodude" wrote in
message ...
Hi,
I am creating a large matrix analysis of for my company. I need the
value of each cell (0 to 1.0) in my matrix to be displayed in different
colors depending on what value band it falls within. I need at least 6
color bands (e.g values less than 0.1 to be blue, values between 0.1
and 0.2 to be green, and so on.).
To clarify I need the CELL BACKGROUND color to be displayed and not the
text displayed according to what color band the value of the cell is.
I know that I can do 3 background colors (color bands) with
"conditional formating" but this is just not enough. I can also change
the text colors with an "IF" function or "LOOKUP" and get the text to
ba changed with all the colors I need.
Does anyone know how to do this?
or does anyone know how to specify the background color of a cell in a
"funtion" [e.g."(green)" fo text color.] as I can then just drop these
into my formulae.
Thanks
A quick response would be great.
Gav
--
phrodude
------------------------------------------------------------------------
phrodude's Profile:
http://www.excelforum.com/member.php...o&userid=36849
View this thread: http://www.excelforum.com/showthread...hreadid=565529