Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 103
Default Extract Capital Letters

Using VBA how would I have the username like Joseph T. Smith be JTS in a
cell? The name could be any length, and if there is not a middle initial such
as Pete Loveless it would be PL.
Thanks for any and all advice and examples.

  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Extract Capital Letters

Recollect one way is to use this fine UDF (FrstLtrs) by Ron Rosenfeld

Here's the extract from Ron's reply to get you going ..

" .. Hi, I want to extract the 1st letter of each word in a string.
So for eg, in the string "my name is fred" I want to extract "mnif"

....

It's easy with a User Defined 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.

To use this UDF, enter a formula of the type
=FrstLtrs(A1) where your string is in A1.

'===========
Function FrstLtrs(str As String) As String
Dim temp
Dim i As Long

temp = Split(Trim(str))

For i = 0 To UBound(temp)
FrstLtrs = FrstLtrs & Left(temp(i), 1)
Next i

End Function
'============
--ron

...."

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"jnf40" wrote:
Using VBA how would I have the username like Joseph T. Smith be JTS in a
cell? The name could be any length, and if there is not a middle initial such
as Pete Loveless it would be PL.
Thanks for any and all advice and examples.

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
how to change small letters to capital letters HOW TO CHANGE Excel Discussion (Misc queries) 4 May 30th 07 01:12 AM
how do i turn all letters into capital letters? KeithT Excel Discussion (Misc queries) 3 May 11th 07 02:13 PM
capital letters to lowercase Xhawk57 Excel Discussion (Misc queries) 5 March 9th 06 03:37 PM
Capital Letters Only Simon Jefford Excel Discussion (Misc queries) 2 February 2nd 06 06:04 PM
Capital Letters Gaute Excel Worksheet Functions 4 March 9th 05 09:55 AM


All times are GMT +1. The time now is 09:51 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"