how do I highlight rows with a certain phrase? [cl

2020-02-07 14:00发布

The place I work for has monthly numbers listed in an Excel spreadsheet. Every month my coworker has to find every row with the phrase Jacobs Eng QP and highlight the row manually. Is there a macro that could do this for me?

3条回答
倾城 Initia
2楼-- · 2020-02-07 14:33

have you tried HOME->Conditional formatting -> Highlight Cell Rules -> Text that contains ?

查看更多
再贱就再见
3楼-- · 2020-02-07 14:38

Select range

Click Conditional Formatting in the ribbon.

then Equal to and type Jacobs Eng QP in the input box.

enter image description here

enter image description here


VBA user-friendly solution

Option Explicit

Sub HighlightCells()

    Dim rangeToCheck As Range
    Set rangeToCheck = Application.InputBox(Prompt:="Please Select Range", Title:="Range Select", Type:=8)

    Dim searchTerm As String
    searchTerm = InputBox("Enter search term")

    Dim cell As Range
    For Each cell In rangeToCheck
        If InStr(1, cell, searchTerm, vbTextCompare) Then cell.Interior.Color = RGB(255, 0, 0)
    Next

End Sub

Additional resource:

查看更多
Lonely孤独者°
4楼-- · 2020-02-07 14:39

I would use custom formatting combined with a formula like INSTR() - I cannot guide you because my office Version uses totally diffferent keywords ( I love the translation of office...)

查看更多
登录 后发表回答