Conditional format more then 3

Solved/Closed
gaggie Posts 1 Registration date Saturday November 5, 2011 Status Member Last seen November 5, 2011 - Nov 5, 2011 at 03:06 AM
 gaggie - Nov 10, 2011 at 12:11 PM
Hello,

I have seen a solution on your web from aquarelle, but how do i put that in my excel, sorry maybe its a basic question. But i have tried it to put it in the visual basic editor with alt-f11, but i do not get any change on the spreadsheet, the range which is set is correct, i do not see it in macro etc.
In other words how can i get this to work when i type those values in, so the background color changes immediatly.

thi was the solution of aquarelle:
Hello,
Try with this macro, you have to write in Visual Basic Editor :

Private Sub Worksheet_Change(ByVal Target As Range)
Set MyPlage = Range("R7:R1000")
For Each Cell In MyPlage

If Cell.Value = "Extreme" Then
Cell.Interior.ColorIndex = 3
End If
If Cell.Value = "Hight" Then
Cell.Interior.ColorIndex = 4
End If
If Cell.Value = "Medium" Then
Cell.Interior.ColorIndex = 18

End If
If Cell.Value = "Low" Then
Cell.Interior.ColorIndex = 6
End If

If Cell.Value <> "Extreme" And Cell.Value <> "Hight" And Cell.Value <> "Medium" And Cell.Value <> "Low" Then
Cell.Interior.ColorIndex = xlNone
End If

Next
End Sub

PLEASE
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Nov 10, 2011 at 09:44 AM
Hi Gaggie,

Did you implement the code in the right way?

This code needs to be put under a worksheet and not in a module.

Right-click the sheets tab you would like the code to work on and select "view code". Then paste the code.

The code will now run only on that sheet whenever a change is made.

Best regards,
Trowa
0
Yes, i did and it worked.
Thanks for the reply.
0