ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   conditional format (https://www.excelbanter.com/excel-worksheet-functions/7987-conditional-format.html)

Julian Campbell

conditional format
 
I can colour cells with conditional format with basic yes/no for example.
But how do I enter say 4 or 5 variants into a conditional format

Thanks



Frank Kabel

Hi
see your other post

--
Regards
Frank Kabel
Frankfurt, Germany

Julian Campbell wrote:
I can colour cells with conditional format with basic yes/no for
example. But how do I enter say 4 or 5 variants into a conditional
format
Thanks




Gord Dibben

Julian

Use VBA or see John MCGimpsey's site for instructions on getting 6 CF for a
cell.

Note: John's work-around is for numerics only.

Looks like you want CF for text, so VBA would be the way to go.

Sample worksheet event code.............

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 = "A": Num = 10 'green
Case Is = "B": Num = 1 'black
Case Is = "C": Num = 5 'blue
Case Is = "D": Num = 7 'magenta
Case Is = "E": Num = 46 'orange
Case Is = "F": Num = 3 'red
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub


Gord Dibben Excel MVP

On Wed, 15 Dec 2004 22:55:00 +0000 (UTC), "Julian Campbell"
wrote:

I can colour cells with conditional format with basic yes/no for example.
But how do I enter say 4 or 5 variants into a conditional format

Thanks




All times are GMT +1. The time now is 11:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com