Identifying Bold Portions of the Cells

lemo

Registered User.
Local time
Today, 04:02
Joined
Apr 30, 2008
Messages
187
hi.
is it possible to identify the bold portion of the text in excel (2007)?

i have quite a few pages of the survey somebody did in Word, with the answer highlighted in yellow (don't ask).

if i copy-paste these Word pages into excel, the highlighted answers become bold. so i have single cells looking like this, for example -

yes no n/a

text-to-columns seems to only pick it up when the first answer is bold, making it not particularly useful.

any suggestions would be greatly appreciated.
thanks in advance,
len
 
Not sure what you want to do exactly but I suspect that you would need to iterate a single character at a time using a construct like

Worksheets("sheetname").Range( ).Characters(n,1).Font.Bold =True Then

you may be able to use a For loop with c.Characters but have never done anything like this just suggestions for investigation.

Brian
 
Decided a Function would be the best way , here is one for you to look at.

Brian


Code:
Function boldtext(c As Range) As String

'Coded by Brian Warnock August 2011
'Select a block of bold text from a Cell

Dim mids As Integer
Dim midl As Integer
Dim l As Integer
Dim n As Integer
l = Len(c)
n = 1

midl = 0
mids = 0

Do Until n > l
If c.Characters(n, 1).Font.Bold = True Then
    midl = midl + 1
    If mids = 0 Then   'First Bold haracter
    mids = n
    End If
ElseIf mids <> 0 Then   'End of Bold
    GoTo alldone
End If

n = n + 1
Loop

alldone:
If mids = 0 Then
boldtext = "NONE"
Else
boldtext = Mid(c, mids, midl)
End If

End Function
 
works like a charm!
thanks so much Brian.. this is just great, i wasn't even sure it was possible.. magic..
l
 

Users who are viewing this thread

Back
Top Bottom