While it is not my code, I believe if you change this line of code...
Code:
Cell.Characters(itm.firstIndex + 1, itm.Length).Font.Underline = True
to this...
Code:
Cell.Characters(itm.firstIndex + 1, itm.Length).Text = UCase(Cell.Characters(itm.firstIndex + 1, itm.Length).Text
that it should work.
Thanks Rick,
gave it a try but its not working, I get error message saying Compile error: Expected: list separator or )
Any ideas?
Sub UnderlineKeyWords()
Dim AllMatches As Object
Dim itm As Variant
Dim Cell As Range
Dim lr As Long
Const myCols As String = "G:I"
Application.ScreenUpdating = False
lr = Columns(myCols).Find(What:="*", After:=Columns(myCols).Cells(1), LookIn:=xlValues, SearchDirection:=xlPrevious).Row
Columns(myCols).Resize(lr).Font.Underline = False
With CreateObject("VBScript.RegExp")
.Global = True
.IgnoreCase = True
.Pattern = "\b(" & Join(Application.Transpose(Sheets("Words").Range("A1", Sheets("Words").Cells(Rows.Count, "A").End(xlUp)).Value), "|") & ")\b"
For Each Cell In Columns(myCols).Resize(lr).Cells
Set AllMatches = .Execute(Cell.Text)
For Each itm In AllMatches
Cell.Characters(itm.firstIndex + 1, itm.Length).Text = UCase(Cell.Characters(itm.firstIndex + 1, itm.Length) . Text
Next itm
Next Cell
End With
Application.ScreenUpdating = True
End Sub