More than 3 conditional formats in Excel
Solved/Closed
Related:
- Conditional formatting graded color scale
- Color 65535 - Guide
- Pdf xchange scale ratio - Guide
- Powertoys color picker download - Download - Other
- Sound card color code - Guide
- Foxit measure tool scale - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Jul 26, 2010 at 12:24 PM
Jul 26, 2010 at 12:24 PM
By the power of search, using just the title of your question, i get https://ccm.net/s/More+than+3+conditional+formats+in+Excel
Jul 26, 2010 at 01:45 PM
Jul 26, 2010 at 02:22 PM
So now you should have
The second change you need to make is change this
Set MyPlage = Range("R7:R1000")MyPlage refered to the range where to color was to be applied. You change it to your requirement as for example
Set MyPlage = Range("A7:F56")Now to Run this modifed macro. Of course you need to modify the conditions. Personally I am not a big fan of a lot of IFs
So instead of
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 <> "Extreme" And Cell.Value <> "Hight" And Cell.Value <> "Medium" And Cell.Value <> "Low" Then Cell.Interior.ColorIndex = xlNone End Ifyou can have
Select Case Cell.Value Case = "Extreme" Cell.Interior.ColorIndex = 3 Case = "Hight" Cell.Interior.ColorIndex = 4 Case Else Cell.Interior.ColorIndex = xlNone End SelectJul 26, 2010 at 02:36 PM
Private Sub ConditionalFormatAfterTheFact()
Set MyPlage = Range("C2:C8381")
For Each Cell In MyPlage
Select Case Target
Case 106576 To 154925
Cell.Interior.ColorIndex = 46
Case 235523 To 241668
Cell.Interior.ColorIndex = 46
Case 368764 To 397255
Cell.Interior.ColorIndex = 46
Case 413751 To 419523
Cell.Interior.ColorIndex = 46
Case 495867 To 519225
Cell.Interior.ColorIndex = 46
Case Else
Cell.Interior.ColorIndex = xlNone
End Select
Next
End Sub
and it did not work. What did I do wrong?
Jul 26, 2010 at 02:57 PM
Select Case Target
There is no "Target". There is "Cell"
Select Case Cell.Value
Jul 26, 2010 at 03:01 PM