I have this macro that seems to have a quirk where it is not looking through all the columns that are selected. This is looking for keywords and changing the font to bold red type for just those keywords in a cell. It works but am now seeing that it is not looking through all the columns selected in the range. Any thoughts of what you see could be the problem is greatly appreciated.
Sub TestMultipleColumn()
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 or String with a Comma (ex. string1,string2)"
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