Highlighting row based on text

Sean Lim

New Member
Joined
Jan 27, 2022
Messages
6
Office Version
  1. 2013
Platform
  1. Windows
I am trying to highlight the row in red colour from B to AS based on the word 'QUARANTINE' and unhighlight if the word is 'SERVICEABLE'.
Thank you!


TESTING.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAY
1PLANT: 2896
2
3STILL WITH REPAIR CENTREAOG OUTBOUNDQUARANTINE PARTSRESERVEDNON CARESING POOL ITEMSFOR SCRAP
407/29/2013 & 08/07/2013 & 08/12/2013 & 08/14/2013 & 08/15/2013 & 08/16/2013 & 08/17/2013 & 08/19/2013
5UPS REF#STOCK TO DOCK DATESTOCK TO SAP DATESTOCK TO INV DATEPART NODESCRIPTIONSSERIAL NOS.PlatformINVENTORY TYPESTATUSFAACAAEASACAASCAACJCABDCAMCERTIFICATE OF CONFORMANCEBILATERAL AGREEMENTOTHERS IMPORT CUSTOM VALUE (USD) EXPORT CUSTOM VALUE (USD) RECEIVED FROMINBOUND VIAINBOUND FLIGHT DETAILSINBOUND REFERENCESWEIGHT (Lbs)WEIGHT (KG) DIMENSION (INCHES) LTH WTH HTDIMENSION (CM) LTH WTH HTQTY INQTY OUTQTY BALDATE CARE IS NOTIFIEDDATE SHIPPEDPOD DATE / STATUSOUTBOUND TO STATUS OUTBOUND VIAOUTBOUND FLIGHT DETAILSOUTBOUND REFERENCESLOCATIONIMPORT PERMITOutbound PermitSAP (02 July 2020)RemarksCC STATUS
6NA18-Dec-0618-Dec-0618-Dec-061779MK2VALVE SCAVENGE NO17792124V2500SERVICEABLEREPAIREDYESYESNANANANANAREPORTUSD 7,205.00GOODRICH UKDHL9908457451P/O: 3438267/20023135EG8, REF: RT388600014.42111111282828101   A5BS17B04
7NA3-Jan-073-Jan-073-Jan-07808603-1DUCT, REHEATER OUTLETNAB777-Non SerializedSERVICEABLENEWYESNANANANANANANO REPORTUSD 154.10HS USDHL9219052721P/O: ANZ-028, REF: 2471869TL12.21111111272728101   A5BS11D04
8NA8-Jan-078-Jan-078-Jan-0711388-2SENSOR ASSY COOLING AIRFLOW1357B777QUARANTINENEWYESNANANANANANANO REPORTUSD 1,414.85HS USDHL9219053141P/O: ANZ-043, REF: 2471919TL2.21111111272727101   A5BS11E04
9NA26-Jan-0726-Jan-0726-Jan-07810503-8CONTROLLER, EAI VALVE2017B777SERVICEABLENEWYESNANANANANANANO REPORTUSD 1,719.61HS USDHL9225280105P/O: ANZ-012, REF: 2471718TL4.42999222223101   A5BS11E04
10NA2-May-072-May-072-May-0773984300OIL TEMPERATURE, THERMOCOUPLE3700V2500SERVICEABLEINSPECTEDYESYESNAYESNANANAWORK ORDER FORMUSD 250.00GRAND PRAIRIEDHL8151222892P/O: 3709833, REF: 513692.21999232323101   A5BS20A04
11NA21-May-0721-May-0721-May-07810247-1DUCT, CONDENSER REHEATER INNAB777-Non SerializedSERVICEABLENEWYESNANANANANANANO REPORTUSD 774.99USD 774.99HS USDHL7559940032P/O: ANZ-041, REF: 2471912TL11.0530202077505011018-Jun-2018-Jun-2018-Jun-20HS WINDSOR USANORMALFEDEXGP#118173-813647797546P/O: 403147952/10
12 
13
14
15
16
HSCARE MASTER LIST 2011-CUR
Cell Formulas
RangeFormula
AF6:AH11AF6=AC6*2.54
AL6:AL10AL6=IF($E6>1,(IF($AK6=0,IF(AL6="",TODAY(),AL6),"")),"")
AM6:AM10AM6=AL6
AB6:AB11AB6=AA6/2.2
AK6:AK11AK6=AI6-AJ6
AN6:AN11AN6=AL6
H12H12=IFNA((VLOOKUP(E12,E:H,4,FALSE)),"")
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Use conditional Formatting..

And change the Applies to, to match your Range of Rows.

1644564755900.png


The Formula $I6 relates to the Top Row of the Range, and only the column is locked.

HTH
 
Upvote 0
Use conditional Formatting..

And change the Applies to, to match your Range of Rows.

View attachment 57544

The Formula $I6 relates to the Top Row of the Range, and only the column is locked.

HTH

I have tried before, but this list keeps growing, everyday there are new data added into it. Sometimes I have to insert or delete row.
So conditional formatting does not work. I am looking for VBA help.
However, thank you for your time!
 
Upvote 0
Hi
Try
In sheet module
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns("I")) Is Nothing Then
        If Target.Value = UCase("Quarantine") Then
            Rows(Target.Row).EntireRow.Interior.Color = vbRed
            Else
            Rows(Target.Row).EntireRow.Interior.Color = vbWhite
        End If
    End If
End Sub
 
Upvote 0
Sorry
Try this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns("I")) Is Nothing Then
        If Target.Value = UCase("Quarantine") Then
          Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = vbRed
            Else
            Rows(Target.Row).EntireRow.Interior.Color = vbWhite
        End If
    End If
End Sub
 
Upvote 0
Sorry
Try this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns("I")) Is Nothing Then
        If Target.Value = UCase("Quarantine") Then
          Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = vbRed
            Else
            Rows(Target.Row).EntireRow.Interior.Color = vbWhite
        End If
    End If
End Sub
Hi Mohadin, it works like magic!
But I am sorry to trouble you. Instead of vbWhite, can it be change to no colour fill instead?
Also, can I add a few other highlighting conditions?

If Column "I" has the word "RESERVED", highlight Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(204,102,255)
If Column "AP" has the word "AOG", highlight Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(255,204,153)

Thank you!
 

Attachments

  • TEST.png
    TEST.png
    35.9 KB · Views: 3
Upvote 0
Hi
Try
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Columns("I"), Columns("AP"))) Is Nothing Then
        Select Case Target.Value
        Case UCase("Quarantine")
             Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = vbRed
        Case UCase("RESERVED")
             Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(204, 102, 255)
        Case UCase("AOG")
             Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(255, 204, 153)
            Case Else
              Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(255, 255, 255)
        End Select
    End If
End Sub

Or
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Columns("I"), Columns("AP"))) Is Nothing Then
     With Range(Cells(Target.Row, 2), Cells(Target.Row, 41))
        Select Case Target.Value
        Case UCase("Quarantine")
            .Interior.Color = vbRed
        Case UCase("RESERVED")
             .Interior.Color = RGB(204, 102, 255)
        Case UCase("AOG")
             .Interior.Color = RGB(255, 204, 153)
            Case Else
              .Interior.Color = RGB(255, 255, 255)
        End Select
         End With
    End If
End Sub
 
Upvote 0
Solution
Hi
Try
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Columns("I"), Columns("AP"))) Is Nothing Then
        Select Case Target.Value
        Case UCase("Quarantine")
             Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = vbRed
        Case UCase("RESERVED")
             Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(204, 102, 255)
        Case UCase("AOG")
             Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(255, 204, 153)
            Case Else
              Range(Cells(Target.Row, 2), Cells(Target.Row, 41)).Interior.Color = RGB(255, 255, 255)
        End Select
    End If
End Sub

Or
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Columns("I"), Columns("AP"))) Is Nothing Then
     With Range(Cells(Target.Row, 2), Cells(Target.Row, 41))
        Select Case Target.Value
        Case UCase("Quarantine")
            .Interior.Color = vbRed
        Case UCase("RESERVED")
             .Interior.Color = RGB(204, 102, 255)
        Case UCase("AOG")
             .Interior.Color = RGB(255, 204, 153)
            Case Else
              .Interior.Color = RGB(255, 255, 255)
        End Select
         End With
    End If
End Sub
Hi Mohadin, it works!
Thank you so much!
 
Upvote 0
You are very welcome
And thank you for the feedback
Be happy and safe
Regards
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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