Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Conditional Formatting - 6 conditions

Hi,

Conditional formatting allows for 3 conditions.

I require 6 for the following ranges of data in a field spannin A1 to G50

0-0.1 pale yellow
0.1-0.25 yellow
0.25-1.0 pale orange
1.0-1.5 orange
1.5-2.0 pale red
2.0 red


I guess an IF, THEN statement might work?

Can anyone help?

Thanks,

Roger
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Conditional Formatting - 6 conditions

If you are not using XL2007 (and your comment about 3 condition seems to
indicate you are not), then you will need to use VB event code to handle
your 6 conditions. Is a VB solution acceptable?

--
Rick (MVP - Excel)


"Roger on Excel" wrote in message
...
Hi,

Conditional formatting allows for 3 conditions.

I require 6 for the following ranges of data in a field spannin A1 to G50

0-0.1 pale yellow
0.1-0.25 yellow
0.25-1.0 pale orange
1.0-1.5 orange
1.5-2.0 pale red
2.0 red


I guess an IF, THEN statement might work?

Can anyone help?

Thanks,

Roger


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Conditional Formatting - 6 conditions

A VB solution would be very satisfactory - do you have some code?

Roger



"Rick Rothstein" wrote:

If you are not using XL2007 (and your comment about 3 condition seems to
indicate you are not), then you will need to use VB event code to handle
your 6 conditions. Is a VB solution acceptable?

--
Rick (MVP - Excel)


"Roger on Excel" wrote in message
...
Hi,

Conditional formatting allows for 3 conditions.

I require 6 for the following ranges of data in a field spannin A1 to G50

0-0.1 pale yellow
0.1-0.25 yellow
0.25-1.0 pale orange
1.0-1.5 orange
1.5-2.0 pale red
2.0 red


I guess an IF, THEN statement might work?

Can anyone help?

Thanks,

Roger



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Conditional Formatting - 6 conditions


'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "A1:G50" '<=== 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 Is <= 0.1: .Interior.ColorIndex = 36 'pale yellow
Case Is <= 0.25: .Interior.ColorIndex = 6 'yellow
Case Is <= 1: .Interior.ColorIndex = 45 'light
orange
Case Is <= 1.5: .Interior.ColorIndex = 46 'orange
Case Is <= 2: .Interior.ColorIndex = 38 'rose
Case Else: .Interior.ColorIndex = 3 'red
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

"Roger on Excel" wrote in message
...
A VB solution would be very satisfactory - do you have some code?

Roger



"Rick Rothstein" wrote:

If you are not using XL2007 (and your comment about 3 condition seems to
indicate you are not), then you will need to use VB event code to handle
your 6 conditions. Is a VB solution acceptable?

--
Rick (MVP - Excel)


"Roger on Excel" wrote in
message
...
Hi,

Conditional formatting allows for 3 conditions.

I require 6 for the following ranges of data in a field spannin A1 to
G50

0-0.1 pale yellow
0.1-0.25 yellow
0.25-1.0 pale orange
1.0-1.5 orange
1.5-2.0 pale red
2.0 red

I guess an IF, THEN statement might work?

Can anyone help?

Thanks,

Roger





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Conditional Formatting - 6 conditions

I don't think you need the EnableEvent nor On Error parts of your code...
changing colors does not kick off a Change event.

--
Rick (MVP - Excel)


"Bob Phillips" wrote in message
...

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "A1:G50" '<=== 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 Is <= 0.1: .Interior.ColorIndex = 36 'pale
yellow
Case Is <= 0.25: .Interior.ColorIndex = 6 'yellow
Case Is <= 1: .Interior.ColorIndex = 45 'light
orange
Case Is <= 1.5: .Interior.ColorIndex = 46 'orange
Case Is <= 2: .Interior.ColorIndex = 38 'rose
Case Else: .Interior.ColorIndex = 3 'red
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

"Roger on Excel" wrote in message
...
A VB solution would be very satisfactory - do you have some code?

Roger



"Rick Rothstein" wrote:

If you are not using XL2007 (and your comment about 3 condition seems to
indicate you are not), then you will need to use VB event code to handle
your 6 conditions. Is a VB solution acceptable?

--
Rick (MVP - Excel)


"Roger on Excel" wrote in
message
...
Hi,

Conditional formatting allows for 3 conditions.

I require 6 for the following ranges of data in a field spannin A1 to
G50

0-0.1 pale yellow
0.1-0.25 yellow
0.25-1.0 pale orange
1.0-1.5 orange
1.5-2.0 pale red
2.0 red

I guess an IF, THEN statement might work?

Can anyone help?

Thanks,

Roger







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Conditional Formatting - 6 conditions

Hi Bob,

Ive tried the code, but it doesnt seem to work on my data set - I will try
it on a fresh spreadsheet

Thanks,

Roger

"Bob Phillips" wrote:


'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "A1:G50" '<=== 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 Is <= 0.1: .Interior.ColorIndex = 36 'pale yellow
Case Is <= 0.25: .Interior.ColorIndex = 6 'yellow
Case Is <= 1: .Interior.ColorIndex = 45 'light
orange
Case Is <= 1.5: .Interior.ColorIndex = 46 'orange
Case Is <= 2: .Interior.ColorIndex = 38 'rose
Case Else: .Interior.ColorIndex = 3 'red
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

"Roger on Excel" wrote in message
...
A VB solution would be very satisfactory - do you have some code?

Roger



"Rick Rothstein" wrote:

If you are not using XL2007 (and your comment about 3 condition seems to
indicate you are not), then you will need to use VB event code to handle
your 6 conditions. Is a VB solution acceptable?

--
Rick (MVP - Excel)


"Roger on Excel" wrote in
message
...
Hi,

Conditional formatting allows for 3 conditions.

I require 6 for the following ranges of data in a field spannin A1 to
G50

0-0.1 pale yellow
0.1-0.25 yellow
0.25-1.0 pale orange
1.0-1.5 orange
1.5-2.0 pale red
2.0 red

I guess an IF, THEN statement might work?

Can anyone help?

Thanks,

Roger





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
How to use 2 conditions in conditional formatting Asoka Walpitagama - Brandix College IT Excel Discussion (Misc queries) 1 November 12th 09 06:41 AM
Conditional Formatting - more than 3 conditions LinLin Excel Discussion (Misc queries) 4 January 19th 09 10:05 PM
Conditional formatting - with 2 conditions Forum freak \(at work\) Excel Discussion (Misc queries) 2 October 24th 08 05:00 PM
Conditional formatting should allow more than three conditions. Joshua, Technical Editor Excel Discussion (Misc queries) 1 July 26th 06 12:44 PM
Conditional Formatting with more than 3 conditions terrapinie Excel Programming 6 January 27th 05 04:03 PM


All times are GMT +1. The time now is 01:08 AM.

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"