Option Explicit
Sub BoldMe()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Dim cel1 As Range
Dim cel2 As Range
Dim lngCel As Long
Dim strFirstAddress As String
Dim lAppCalc As Long
Dim strArray
Dim strText
Dim strIn As String
'Get working range from user
On Error Resume Next
Set rng1 = Application.InputBox("Please select range to search", "User range selection", Selection.Address(0, 0), , , , , 8)
On Error GoTo 0
If rng1 Is Nothing Then Exit Sub
strIn = Application.InputBox("Enter words to bold, separated by , (no spaces)", , , , , , , 2)
strArray = Split(strIn, ",")
With Application
lAppCalc = .Calculation
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
For Each strText In strArray
'a) match string to entire cell, case insensitive
'Set cel1 = rng1.Find(strText, , xlValues, xlWhole, xlByRows, , False)
'b) match string to entire cell, case sensitive
'Set cel1 = rng1.Find(strText, , xlValues, xlWhole, xlByRows, , True)
'c)match string to part of cell, case insensititive
Set cel1 = rng1.Find(strText, , xlValues, xlPart, xlByRows, , False)
'd)match string to part of cell, case sensititive
' Set cel1 = rng1.Find(strText, , xlValues, xlPart, xlByRows, , True)
'A range variable - rng2 - is used to store the range of cells that contain the string being searched for
If Not cel1 Is Nothing Then
Set rng2 = cel1
strFirstAddress = cel1.Address
Do
Set cel1 = rng1.FindNext(cel1)
Set rng2 = Union(rng2, cel1)
Loop While strFirstAddress <> cel1.Address
End If
'Further processing of found range if required
If Not rng2 Is Nothing Then
For Each cel2 In rng2
lngCel = 1
Do While InStr(lngCel, cel2.Value, strText) <> 0
lngCel = InStr(lngCel, cel2.Value, strText)
cel2.Characters(lngCel, Len(strText)).Font.FontStyle = "Bold"
lngCel = lngCel + Len(strText)
Loop
Next
End If
Next
With Application
.ScreenUpdating = True
.Calculation = lAppCalc
End With
End Sub