VBA - Conditional formatting based on multiple cell value

nimesh29

New Member
Joined
Mar 20, 2013
Messages
26
HI,
I am trying to add conditional formatting to a sheet in the workbook through a macro. I have multiple conditions in columns H & K & P; if column 'H' has certain value then the color of row changes based on the range. Then I want to clear the colored Row if the Column 'K' has either "Approved or Resubmit" or highlight the in Red if the value is "Rejected".


Then once Rejected submittal are returned I need to clear out the Red highlight based on column 'P' value, "Resubmitted".


I got this started but, I am only able to things based on column 'H', don't really know how to add an additional condition from different columns.

Here is the code I have so far:

Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A2:p100")) Is Nothing Then Exit Sub
    Select Case Cells(Target.Row, "F").Value
        Case "Team1"
            Range(Cells(Target.Row, "A"), Cells(Target.Row, "P")).Interior.ColorIndex = 44
        Case ""
            Range(Cells(Target.Row, "A"), Cells(Target.Row, "P")).Interior.ColorIndex = xlNone
        Case Else
            Range(Cells(Target.Row, "A"), Cells(Target.Row, "P")).Interior.ColorIndex = 6
    End Select
End Sub</code>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,217,371
Messages
6,136,167
Members
449,996
Latest member
duraichandra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top