ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   More than 3 rules of conditional formatting (https://www.excelbanter.com/excel-discussion-misc-queries/148787-more-than-3-rules-conditional-formatting.html)

Mats K[_2_]

More than 3 rules of conditional formatting
 
Is there any ways to have more than 3 formats with conditional formatting?
I've been thinking about styles, but i dont know if i can change a style of
a cell with formulas.
Any suggestions?

Mike H

More than 3 rules of conditional formatting
 
Hi,

I'm not sure about styles but you can do it using the worksheet_change
event. Right click the sheet tab and view code and paste this in. Add as many
conditions as you like:-

Private Sub Worksheet_Change(ByVal Target As Range)
Const myRange As String = "A1:B20"
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(myRange)) Is Nothing Then
With Target
Select Case .Value
Case Is Range("F1"): .Interior.ColorIndex = 46 'Orange
Case 2: .Interior.ColorIndex = 3 'Red
Case 3: .Interior.ColorIndex = 6 'Yellow
Case 4: .Interior.ColorIndex = 10 'Green
End Select
End With
End If
Application.EnableEvents = True
End Sub

"Mats K" wrote:

Is there any ways to have more than 3 formats with conditional formatting?
I've been thinking about styles, but i dont know if i can change a style of
a cell with formulas.
Any suggestions?


MartinW

More than 3 rules of conditional formatting
 
Hi Mats,

This link to Bob Phillips's site might interest you

http://www.xldynamic.com/source/xld.....Download.html

HTH
Martin


"Mats K" wrote in message
...
Is there any ways to have more than 3 formats with conditional formatting?
I've been thinking about styles, but i dont know if i can change a style
of
a cell with formulas.
Any suggestions?





All times are GMT +1. The time now is 02:49 PM.

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