ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional Formatting options (https://www.excelbanter.com/excel-discussion-misc-queries/32718-conditional-formatting-options.html)

smith.james0

Conditional Formatting options
 

Is there any way of getting more than three conditions when conditional
formatting?


--
smith.james0
------------------------------------------------------------------------
smith.james0's Profile: http://www.excelforum.com/member.php...o&userid=16230
View this thread: http://www.excelforum.com/showthread...hreadid=382635


JE McGimpsey

Depends on what you're looking to do. If you're interested in no more
than 6 font colors (or a combination of font and no more than 4
background colors for a total of 6), see

http://www.mcgimpsey.com/excel/conditional6.html


For more/different combinations, see

http://www.mvps.org/dmcritchie/excel/event.htm#case

In article ,
smith.james0
wrote:

Is there any way of getting more than three conditions when conditional
formatting?


smith.james0


I want the cells to change colour depandent on the value in them, i need
4 colours tho :rolleyes:


--
smith.james0
------------------------------------------------------------------------
smith.james0's Profile: http://www.excelforum.com/member.php...o&userid=16230
View this thread: http://www.excelforum.com/showthread...hreadid=382635


JE McGimpsey

If one of the colors is the default color, you can use CF. Otherwise use
the reference I gave you.

In article ,
smith.james0
wrote:

I want the cells to change colour depandent on the value in them, i need
4 colours tho


Annabelle

I used this formula for a project status report that required 4 colors
(added cases for another spreadsheet requiring 8 colors). Right click
on the worksheet name -- select View Code -- paste this formula. The
result: when "Green" is entered in a cell, both the background and the
font is green. You can replace the verbiage in quotation with your
specific value. Remove the font section if you just want to change the
cell shading.

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("a6:af250"))
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "Green": Num = 4 'green
Case Is = "Yellow": Num = 6 'yellow
Case Is = "Red": Num = 3 'red
Case Is = "Blue": Num = 11 'dark blue
End Select
'Apply the color to background
rng.Interior.ColorIndex = Num
'Determine the color
Select Case rng.Value
Case Is = "Green": Num = 4 'green
Case Is = "Yellow": Num = 6 'yellow
Case Is = "Red": Num = 3 'red
Case Is = "Blue": Num = 11 'dark blue
End Select
'Apply the color to the font
rng.Font.ColorIndex = Num
Next rng
End Sub



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

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