highlight entire row when contains certain letters in word(s) in the whole worksheet
I want a vba that can highlight the entire row when certain letters were found in word(s) in cells
i found the below code, but it works when there is an exact match ONLY.
PHP Code:
Sub colorentirerow_ifvalue()
Dim r As Variant Dim k As Variant Dim i As Variant
Range("A1", ActiveCell.SpecialCells(xlLastCell)).Select For Each r In Selection If r.Value Like "HUA" Then r.EntireRow.Interior.ColorIndex = 22 End If Next
Range("A1", ActiveCell.SpecialCells(xlLastCell)).Select For Each k In Selection If k.Value Like "KIND" Then k.EntireRow.Interior.ColorIndex = 21
End If Next
Range("A1", ActiveCell.SpecialCells(xlLastCell)).Select For Each i In Selection If i.Value Like "THANKS" Then i.EntireRow.Interior.ColorIndex = 20
End If Next
End Sub
i need 1. partial matches to be highlight too.
e.g. A cell contains "CHANGHUA" or "HUACHANG" to be found and highlight the entire row 2. treats uppercase or lowercase as the same value.
e.g. A cell contains "hua" or "Hua" to be found and highlight the entire row
If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...
Re: highlight entire row when contains certain letters in word(s) in the whole worksheet
to JOHN H. DAVIS
i tried,it works only if the filtered words ("HUA" ,"KIND" and "THANKS") in Column A. In my case, it can be all over the entire worksheet.
Can it be fix?
Bookmarks