Where is says Case 4, change that to Case n where n is the number that you
want to trigger a green.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"F7772" wrote in message
...
Thank you, the Case function has me confused, let's say I want it green,
where do i use the Index as 10? Cheers.
"Bob Phillips" wrote:
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B1:B10"
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 200: .Interior.ColorIndex = 3 'red
Case 2: .Interior.ColorIndex = 6 'yellow
Case 3: .Interior.ColorIndex = 5 'blue
Case 4: .Interior.ColorIndex = 10 'green
Case 5: .Interior.ColorIndex = 1
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
RP
(remove nothere from the email address if mailing direct)
"F7772" wrote in message
...
I have a spreadsheet that populates a number of cells. The user has
the
option to change the cell values. Now, ifthe user changes a value, I
want
the
value to be of a different colour.
Say the code-generated value of cell B1 is 137 (black colour)
if the user changes the value to 200, I want the colour to be red
Is this possible?
Thanks in advance...
|