I am looping through cells trying to make certain parts of cell values bold. I have a cell with contents:
<b>This part should be bold</b> but this should not be
I can get the correct part to be bold but the next step is to remove the tags. The following lines cause an issue:
Cells.Replace What:="<b>", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Cells.Replace What:="</b>", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
When these lines run (in either order), the whole cell value becomes bold. More specifically, after running it line by line, running either line will have the same result. I am new to VBA and not sure what's causing this.
The function I'm using to make the substring bold is:
fCell.Characters(Start:=m, Length:=n - m + 1).Font.Bold = True
where fCell is being looped over and m and n are the indices locating <b> and </b> respectively.