Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to chose bold text in a sentence in Excel?

11 views
Skip to first unread message

Vinh Tu@discussions.microsoft.com Luong Vinh Tu

unread,
Sep 10, 2006, 6:58:01 PM9/10/06
to
I have a text in a cell
Barcelona vs Osasuna ("Barcelona" is bold)
Now I want to chose the text "Barcelona"
How to do this ?
Thanks

Ron Rosenfeld

unread,
Sep 10, 2006, 7:46:55 PM9/10/06
to

Not sure what you mean when you write "chose the text".

If you want to select it, double click in the cell and drag the cursor across
the bold letters. You can then copy it and paste it elsewhere.

If you want a function to return all of the bolded text in a cell as the
result, then you will need to use a VBA function.

<alt><F11> opens the VB Editor.
Ensure your project is highlighted in the project explorer window, then
Insert/Module and paste the code below into the window that opens.

To use the function (UDF), enter a formula into some cell in the form:

=SelBold(cell_ref)

where cell_ref is the cell containing your partially bolded string.

============================================
Option Explicit

Function SelBold(rg As Range) As String
Dim i As Long

For i = 1 To Len(rg.Text)
If rg.Characters(i, 1).Font.Bold = True Then
SelBold = SelBold & Mid(rg.Text, i, 1)
End If
Next i

End Function
============================


--ron

0 new messages