View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 380
Default MultiCriteria for Conditional Formating

follow the instructions that I gave you.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Kim Shelton at PDC" wrote in
message ...
Hi, I still cant get this to work. How and Where do I tell case value 1 =

1
so that it will turn to the color selected?

"Bob Phillips" wrote:

Case 1 is the value that is being tested. This assumes that the values

being
tested is a number, put it in quotes if is a string.

..interior.colorindex is where the colour is set. Check the Colorindex
Property in VBA help to see what the values are.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Kim Shelton at PDC" wrote

in
message ...
Thanks Bob, I have pasted everything that you have into a test

spreadsheet
and have A1:A10 in the range where you pointed. I have on the actual
spreadsheet 1 in A1, 2 in A2, 3 in A3 and 4 in A4. But nothing

happens.
What am I doing wrong?

Additionally, So that I can understand, What is the Case 1: mean is

this
the criteria? and what does .interior.colorindex = 10- 'green is this

the
color command portion of this formula???? I am asking so that I can

learn
what I am doing.

"Bob Phillips" wrote:

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H1:H10" '<=== change to suit


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 = 10 'green
Case 2: .Interior.ColorIndex = 5 'blue
Case 40: .Interior.ColorIndex = 3 'tan
Case 4: .Interior.ColorIndex = 6 'yellow
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 xxxx in the email address with gmail if mailing direct)

"Kim Shelton at PDC"

wrote
in
message ...
I have 4 criteria for conditional formatting as follows: I have 4

work
crews.
1=green, 2=blue, 3=tan, 4=yellow. If I type a 4 in the cell I

want
the
fill
color to become yellow etc. I obviously can only do three - How

can
I do
4.
Thanks.