Hello,
i am trying to apply more than three options to excel that changes the background colour of the cell.
my range is R7:R1000
i need a VBA or macro that will change the background colour of the cell as follows
if cell reads "Extreme", change background to red
If Cell reads "High" change background to Purple
If Cell reads "Medium", change background to yellow
If cell reads "Low" change background to green
If cell is empty, do nothing
any assistance would be much appreciated
THANKS
Configuration: Windows XP Internet Explorer 6.0
Hello,
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
Hope this is what you want. Best regards "Pour trouver une solution � ses probl�mes, il faut s'en donner la peine."
|
You could try this..
|
I encountered a similar "problem" if you will today. After hacking a bit this is what I ended up with.
|
I understand how to use the macro to color many different colors within a spreadsheet, but if there are already some colors on the sheet, how would I tell the macro to leave the existing color if it has run through all of the tests and none of them apply. For example, at the end of the macro: it says
|
I came across the code above from OldYgg and it works good for me except that I need to make it conditional. How can I put these two statements together
|
Hi,
|