Separate Bold Text from a string

  • Thread starter Thread starter Mani
  • Start date Start date
M

Mani

How can i separate bold text from a string

for example

East Doncaster Victoria, Australia

If East doncaster is bold i want to separate it in another column.

thanks
 
It would need a UDF.

Function GetBold(rng As Range) As String
Dim mStart As Long
Dim mEnd As Long
Dim i As Long

If rng.Cells.Count > 1 Then

GetBold = CVErr(xlErrRef)
Else

Do
mStart = mStart + 1
Loop Until mStart > Len(rng.Value) Or rng.Characters(mStart,
1).Font.Bold

If mStart > Len(rng.Value) Then Exit Function

mEnd = mStart
Do
mEnd = mEnd + 1
Loop Until mEnd <= Len(rng.Value) And Not rng.Characters(mEnd,
1).Font.Bold

GetBold = Mid$(rng.Value, mStart, mEnd - mStart + 1)
End If
End Function
 
Back
Top