Ochimus
InStr returns the position of the substring you are looking for, you can use that along with Characters to do the formatting.
Option Explicit
Dim a As Long, r As Long
Dim cl As Range, searchText As Range
Dim findText As String, findText2 As String
Sub FORMATBLEND()
With Sheet1
a = .Cells(.Rows.Count, "A").End(xlUp).Row
If a < 2 Then a = 2
For r = 2 To a
'If there is text in COl A
If Not Cells(r, 1) Is Nothing Then
'If Col D is blank, concatenate Cols A - C
If .Cells(r, 4).Value = "" Then
.Cells(r, 4) = .Cells(r, 1).Value & " " & .Cells(r, 2).Value & " " & .Cells(r, 3).Value
findText = .Cells(r, 1)
findText2 = .Cells(r, 2)
If InStr(.Cells(r, 4).Value, findText) Then
'Make Col A string Bold and Col B string Italic - throw runtime error 424
.Cells(r, 4).Characters(InStr(.Cells(r, 4).Value, findText), Len(findText)).Font.Bold = True
End If
If InStr(.Cells(r, 4).Value, findText2) Then
'Make Col B string Bold and Col B string Italic
.Cells(r, 4).Characters(InStr(.Cells(r, 4).Value, findText2), Len(findText2)).Font.Italic = True
End If
End If
End If
Next
End With
End Sub
Bookmarks