Thread: not urgent
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default not urgent

Even better Gary ;-)

Bob

"Gary''s Student" wrote in message
...
Thank you Bob!!

Your approach can also be adapted to other special font characteristics
--
Gary''s Student


"Bob Phillips" wrote:

Function WhatIsUnderlined(inp)
Dim sTemp As String
Dim i As Long
WhatIsUnderlined = ""
If TypeOf inp Is Range Then
If inp.Count = 1 Then
sTemp = inp.Value
Else
WhatIsUnderlined = "#Too many cells"
Exit Function
End If
Else
WhatIsUnderlined = "#Wrong argument type"
End If

For i = 1 To Len(inp)
If inp.Characters(i, 1).Font.Underline = 2 Then
WhatIsUnderlined = WhatIsUnderlined & Mid(sTemp, i, 1)
End If
Next i

End Function


--
HTH

Bob Phillips

"Gary''s Student" wrote in

message
...
I need a UDF that will return the underlined part of a text string.

For
example, if cell A1 contains the string "hello world" and "world" is
underlined, then UnderCap(A1) would return "world"
--
Gary''s Student