Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel extract bold Words in text

Tags:

excel

filter

vba

Can anyone assist me with my Excel Problem? I have a cell filled with text. Some words of this Text are printed bold. Those words are keywords and should be extraxted to another cell in the Row for identification of the keywords. Example:

Text in Cell:

I want to use Google Maps for route informations

Output:

Google; Maps; route;

Thank you in advance!

like image 374
Jens Eger Avatar asked Jan 03 '23 09:01

Jens Eger


1 Answers

You can also use this UDF to produce same result. Please enter below code in module.

 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

Now you can use newly created function to return bold values from any cell.

enter image description here

like image 162
Kresimir L. Avatar answered Mar 01 '23 18:03

Kresimir L.