I know this question has been answered in a previous post; however, it appears that the VBA highlighted the text if any part of the word appeared (i.e. "blue" was highlighted if it was found as 'blue' or 'bluebird'). What I am trying to accomplish is to have a macro find and highlight only when "EWS" is found in any cell contained in columns AU and AV. The search term "EWS" is located in cell AX1. I used the macro below; however, it is highlighting any string that contains "EWS," including "news" "newspaper" etc. How can this be altered where it will only highlight when "EWS" is in the cell? Also, how do I incorporate column AV? The data begins in cell AU1927.
Sub Test1()
Dim strString$, x&
Dim rngCell As Range
strString = Range("AX1").Value
Application.ScreenUpdating = False
For Each rngCell In Range("AU1927", Range("AU" & Rows.Count).End(xlUp))
With rngCell
.Font.ColorIndex = 1
For x = 1 To Len(.Text) - Len(strString) Step 1
If Mid(.Text, x, Len(strString)) = strString Then .Characters(x, Len(strString)).Font.ColorIndex = 5
Next x
End With
Next rngCell
Application.ScreenUpdating = True
End Sub
Sub Test1()
Dim strString$, x&
Dim rngCell As Range
strString = Range("AX1").Value
Application.ScreenUpdating = False
For Each rngCell In Range("AU1927", Range("AU" & Rows.Count).End(xlUp))
With rngCell
.Font.ColorIndex = 1
For x = 1 To Len(.Text) - Len(strString) Step 1
If Mid(.Text, x, Len(strString)) = strString Then .Characters(x, Len(strString)).Font.ColorIndex = 5
Next x
End With
Next rngCell
Application.ScreenUpdating = True
End Sub