LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default conditional formatting for multiple sets of conditions

Gord Dibben posted a solution to setup more than three format conditions (see
below), but it only works for a single set of conditions. Is it possible for
the sheet code to cover two distinct sets of conditions? E.g.:

Range("a1:a10,a20:a30"))
Case Is = "": Num = 2 'white
Case Is = 0: Num = 38 'red
Case Is = 1: Num = 36 'yellow
Case Is = 2: Num = 35 'green
Case Is = 3: Num = 34 'blue

Range("b15:b30,b55:b60"))
Case Is = "": Num = 2 'white
Case Is < 90: Num = 38 'red
Case Is < 80: Num = 36 'yellow
Case Is < 70: Num = 35 'green
Case Is < 50: Num = 34 'blue

TIA.

Posted by Gord Dibben MS Excel MVP 2/6/2007 9:29 AM PST

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("A:A"))
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "Red": Num = 3
Case Is = "Green": Num = 10
Case Is = "Yellow": Num = 6
Case Is = "Blue": Num = 5
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub
 
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
Multiple conditions for conditional formatting plf100 Excel Worksheet Functions 4 September 27th 06 11:00 AM
Multiple conditions in Conditional Formatting guilbj2 Excel Discussion (Misc queries) 0 June 28th 06 09:09 PM
Conditional Formatting for more than 3 conditions MMM Excel Worksheet Functions 4 March 9th 06 01:43 AM
Conditional formatting: I have five conditions, how to do this? Danzguy Excel Discussion (Misc queries) 2 May 11th 05 08:21 AM
Banding with Conditional Formatting with Multiple Conditions Geremia Doan Excel Worksheet Functions 7 February 2nd 05 03:14 PM


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

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

About Us

"It's about Microsoft Excel"