Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dr. Darrell
 
Posts: n/a
Default ... I would like to apply more than 3 conditional formats ...

I would like my Cells to be shaded based on the Values that are entered into
them.

I thought that Conditional Formating would be the answer, but it appears I'm
only able to enter three conditions.

I have a posibility of five values that could be entered into the cells:
"-", "1", "2", "3" or "4".

The conditions I reqiure are"

if the cell contains "-", then shade "light yellow"
if the cell contains "1", then no shade
if the cell contains "2", then shade "grey"
if the cell contains "3", then shade "yellow"
if the cell contains "4", then shade "red"

Is there a means to enter more than the three conditions that are allowed by
the dialog box?

Respectfully,
Darrell
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default ... I would like to apply more than 3 conditional formats ...

Here is an example


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

RP
(remove nothere from the email address if mailing direct)


"Dr. Darrell" wrote in message
...
I would like my Cells to be shaded based on the Values that are entered

into
them.

I thought that Conditional Formating would be the answer, but it appears

I'm
only able to enter three conditions.

I have a posibility of five values that could be entered into the cells:
"-", "1", "2", "3" or "4".

The conditions I reqiure are"

if the cell contains "-", then shade "light yellow"
if the cell contains "1", then no shade
if the cell contains "2", then shade "grey"
if the cell contains "3", then shade "yellow"
if the cell contains "4", then shade "red"

Is there a means to enter more than the three conditions that are allowed

by
the dialog box?

Respectfully,
Darrell



  #3   Report Post  
Dr. Darrell
 
Posts: n/a
Default ... I would like to apply more than 3 conditional formats ...

Bob:

Thanks for the response. Do you mind if I ask you to disect the code and
explain the meaning of each statement?

Respectfully,
Darrell

"Bob Phillips" wrote:

Here is an example


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

RP
(remove nothere from the email address if mailing direct)


"Dr. Darrell" wrote in message
...
I would like my Cells to be shaded based on the Values that are entered

into
them.

I thought that Conditional Formating would be the answer, but it appears

I'm
only able to enter three conditions.

I have a posibility of five values that could be entered into the cells:
"-", "1", "2", "3" or "4".

The conditions I reqiure are"

if the cell contains "-", then shade "light yellow"
if the cell contains "1", then no shade
if the cell contains "2", then shade "grey"
if the cell contains "3", then shade "yellow"
if the cell contains "4", then shade "red"

Is there a means to enter more than the three conditions that are allowed

by
the dialog box?

Respectfully,
Darrell




Reply
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
Can I Apply Conditional Formatting to a Chart? Tim Richards Charts and Charting in Excel 3 October 21st 05 01:56 PM
How do I apply conditional formatting to a text box barneshere Excel Worksheet Functions 1 May 27th 05 06:26 PM
Automatic updating of Conditional Formats using dates MAD Excel Worksheet Functions 5 May 3rd 05 04:44 AM
how do I apply more than 3 conditional formats in excel chetwyndthomas Excel Discussion (Misc queries) 1 January 30th 05 04:24 PM
Conditional Formats in Excel DaveB Excel Worksheet Functions 2 November 15th 04 07:36 AM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"