Extract words in Bold, any solution?
The Stack Overflow post Excel extract bold Words in text contains the following VBA function to extract bold text, character by character:
Public Function findAllBold(ByVal rngText As Range) As String
Dim theCell As Range
Set theCell = rngText.Cells(1, 1)
For i = 1 To Len(theCell.Value)
If theCell.Characters(i, 1).Font.Bold = True Then
If theCell.Characters(i + 1, 1).Text = " " Then
theChar = theCell.Characters(i, 1).Text & ", "
Else
theChar = theCell.Characters(i, 1).Text
End If
Results = Results & theChar
End If
Next i
findAllBold = Results
End Function
This function adds commas between the found words.
To omit this, delete this text : & ", "
.
The entire if
command can in this case be shortened to one line:theChar = theCell.Characters(i, 1).Text
.
Use this function to extract the bold text from the first cell, then extend the formula to the following lines: