Excel Conditional Formatting -- more than 4 conditions by row

  • Thread starter Thread starter heathermcpher822
  • Start date Start date
H

heathermcpher822

Hello,

I have been searching for the answer to the problem of more than 4
conditions and formatting the entire row.

EG:

date status Name Phone#


there are 6 different possible "status" and I would like all of the
data in the row formatted the same.
I have seen VB that will take care of the more than 3 conditions but
the code I have only formats by cell.

can anyone help?

Best Regards,
Heather
 
If you have code then you should be able to edit it to include the entire row in
your formatting.

Here is an example.

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("D:D"))
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "A": Num = 10 'green
Case Is = "B": Num = 1 'black
Case Is = "C": Num = 5 'blue
Case Is = "D": Num = 7 'magenta
Case Is = "E": Num = 46 'orange
Case Is = "F": Num = 3 'red
End Select
'Apply the color to entire row
rng.EntireRow.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top