ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2003 : conditional format for 5 format settings (https://www.excelbanter.com/excel-programming/438129-excel-2003-conditional-format-5-format-settings.html)

Luc[_7_]

Excel 2003 : conditional format for 5 format settings
 
I have Excel 2003 : in this version you are limited to 3 conditional formattings,but i want to use 5 formats, so i run out of luck !

I want to use conditional format for the entire columm Q.

The text wich appears in the cells in column Q (Very Low, Low, Medium, High, Very high) is dependent of the Columns O & P.
The following formula is used :
=INDEX(Risikomatrix;VERGELIJKEN(O77;INDEX(Risikoma trix;0;1);0);VERGELIJKEN(P77;INDEX(Risikomatrix;1; 0);0))

So the cells in column Q can have the value : Very Low, Low, Medium, High, Very high (wich is the result of the values of the cells in col O & P)

When the text in the cell is "Very low" = the color of the cell has to be Green
When the text in the cell is "Low" = the color of the cell has to be Yellow
When the text in the cell is "Medium" = the color of the cell has to be Orange
When the text in the cell is "High" = the color of the cell has to be Light red
When the text in the cell is "Very High= the color of the cell has to be Dark red

Can someone help me with the VBA code.

Thanks,

Luc

Rick Rothstein

Excel 2003 : conditional format for 5 format settings
 
I'm guessing from what you wrote that Column Q contains formulas that display the text you posted when some other cells change their value. If that is correct, then right click the tab at the bottom of the worksheet you want this functionality on, select View Code from the popup menu that appears and then copy/paste the following into the code window that appears...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
With Target.Dependents
If .Column = 17 Then ' 17 is Column "Q"
Select Case UCase(.Value)
Case "VERY LOW"
.Interior.ColorIndex = 4
Case "LOW"
.Interior.ColorIndex = 6
Case "MEDIUM"
.Interior.ColorIndex = 45
Case "HIGH"
.Interior.ColorIndex = 22
Case "VERY HIGH"
.Interior.ColorIndex = 3
Case Else
.Interior.ColorIndex = 0
End Select
End If
End With
End Sub

Now, when you change any cells that the formulas in Column Q depend on, then the affected cells in Column Q will change color as requested.

--
Rick (MVP - Excel)


"Luc" wrote in message ...
I have Excel 2003 : in this version you are limited to 3 conditional formattings,but i want to use 5 formats, so i run out of luck !

I want to use conditional format for the entire columm Q.

The text wich appears in the cells in column Q (Very Low, Low, Medium, High, Very high) is dependent of the Columns O & P.
The following formula is used :
=INDEX(Risikomatrix;VERGELIJKEN(O77;INDEX(Risikoma trix;0;1);0);VERGELIJKEN(P77;INDEX(Risikomatrix;1; 0);0))

So the cells in column Q can have the value : Very Low, Low, Medium, High, Very high (wich is the result of the values of the cells in col O & P)

When the text in the cell is "Very low" = the color of the cell has to be Green
When the text in the cell is "Low" = the color of the cell has to be Yellow
When the text in the cell is "Medium" = the color of the cell has to be Orange
When the text in the cell is "High" = the color of the cell has to be Light red
When the text in the cell is "Very High= the color of the cell has to be Dark red

Can someone help me with the VBA code.

Thanks,

Luc


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

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