![]() |
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. |
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. |
All times are GMT +1. The time now is 05:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com