This macro is working well but I have come across a snag where there may be times when a keyword must be case sensitive. For example one keyword is BAC but it is picking up simple words like back and such. This is the code I am using but not sure where and how to incorporate the case sensitive piece. Do I use an Exact or UCase function somewhere?
Sub UserInputSearch()
Dim r As Range, LastRow As Long
Dim rs As Range
Dim v As Variant, s As String
Dim TextEntry As String
Dim Msg As String
Dim Entry As String
Dim x As Long, where As Long
Dim Rng As Range
Dim CellCount As String
Set rs = Application.InputBox(Prompt:="Select the Column for Lookup", Title:="Range Select", Type:=8)
rs.Name = "Lookup"
Msg = "Separate Each Keyword with a Comma (ex. brain,seizure)"
TextEntry = InputBox(Msg)
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Entry = TextEntry
v = Split(Entry, ",")
For Each r In Range("Lookup")
For x = 0 To UBound(v)
If InStr(1, r.Value, v(x), vbTextCompare) > 0 Then
where = InStr(1, r.Value, v(x), vbTextCompare)
With r
.Characters(Start:=where, Length:=Len(v(x))).Font.FontStyle = "Bold"
.Characters(Start:=where, Length:=Len(v(x))).Font.ColorIndex = 3
End With
End If
Next
Next r
Range("A1").Select
Exit Sub
End Sub
Bookmarks