I am trying to come up with some code that loops through column I and if it Contains ("*NOT*") or Starts with ("*SHOP WAIT") it will highlight the row A:BI.
My one example Highlights the entire row. The second does nothing. Can either one or both be modified to do what I want?
My one example Highlights the entire row. The second does nothing. Can either one or both be modified to do what I want?
VBA Code:
Dim Cell As Range, Addr As String
With Range("I2", Cells(Rows.Count, "I").End(xlUp))
Set Cell = .Find("*NOT*", , xlValues, , , , False, , False)
If Not Cell Is Nothing Then
Addr = Cell.Address
Do
Cell.EntireRow.Interior.Color = RGB(255, 167, 155)
' Cell.EntireRow.Interior.ColorIndex = 6
Set Cell = .FindNext(Cell)
Loop While Not Cell Is Nothing And Cell.Address <> Addr
End If
End With
With Range("I2", Cells(Rows.Count, "I").End(xlUp))
Set Cell = .Find("*SHOP WAIT", , xlValues, , , , False, , False)
If Not Cell Is Nothing Then
Addr = Cell.Address
Do
' Cell.EntireRow.Interior.Color = RGB(255, 167, 155)
Cell.EntireRow.Interior.ColorIndex = 6
Set Cell = .FindNext(Cell)
Loop While Not Cell Is Nothing And Cell.Address <> Addr
End If
End With
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim myCell As Range
For Each myCell In Range("I2:I" & Range("I" & Rows.Count).End(xlUp).Row)
If myCell.Value = "*NOT*" Then Intersect(myCell.EntireRow, Range("A:BI")).Interior.Color = RGB(255, 167, 155)
If myCell.Value = "*SHOP WAIT" Then Intersect(myCell.EntireRow, Range("A:BI")).Interior.ColorIndex = 6
Next