#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default not urgent

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default not urgent

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default not urgent

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IME MODE FOR EXCEL 2007 (URGENT URGENT) Stella Wong Excel Discussion (Misc queries) 1 August 23rd 08 11:16 PM
Urgent Help!!! VIVEKMANE Excel Worksheet Functions 2 October 29th 07 05:20 AM
Urgent-Urgent VBA LOOP Jeff Excel Discussion (Misc queries) 0 October 6th 05 05:46 PM
Macro help urgent urgent Dave Peterson[_3_] Excel Programming 0 September 4th 03 03:59 PM
Macro help urgent urgent chandra Excel Programming 0 September 4th 03 03:50 PM


All times are GMT +1. The time now is 01:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"