I have code below to bold this portion of text "Do NOT amend my links." in B2 that contains other text as well that is wrapped
It would be appreciated if someone coild amend my code
It would be appreciated if someone coild amend my code
Code:
Sub BoldTextInCell()
Dim searchText As String
Dim cellText As String
Dim cellRange As Range
Dim startPos As Long
Dim found As Boolean
' Set the text you want to bold
searchText = "Do NOT amend my links"
' Set the cell range
Set cellRange = ThisWorkbook.Sheets("Email").Range("B2")
' Get the cell's text
cellText = cellRange.Value
' Initialize the starting position
startPos = 1
found = False
Do
startPos = InStr(startPos, cellText, searchText, vbTextCompare)
If startPos > 0 Then
cellRange.Characters(startPos, Len(searchText)).Font.Bold = True
startPos = startPos + 1
found = True
End If
Loop While startPos > 0
' Display a message if the text was not found
If Not found Then
MsgBox "Text not found in the cell."
End If
End Sub