Fisrt letter of every word

G

Graham H

Is there any way I can concatenate the first letters of every word in a phrase?
eg management of ancient wood pasture
Answer I am after in one cell "moawp"
The lenhgth of the phrases would be variable, sya up to 15 words.
I would value any help.

Kind Regards
Graham
 
M

Mike H

Graham,

I copied this from something written (I think) by Ron Rosenfield but if I've
credited the wrong person then apologies to the original author.

Put this UDF in a general module

Function Firsts(str As String) As String
part = Split(Trim(str))
For x = 0 To UBound(part)
Firsts = Firsts & Left(part(x), 1)
Next
End Function


Call with =Firsts(A1)
where A1 is the string you want the first letters of.

Mike
 
R

Rick Rothstein \(MVP - VB\)

I see you already have an answer, but I spent the time working this method
up, so I thought I would post it anyway (mainly for the archives)...

Function FirstLetters(ByVal Str As String) As String
Dim X As Long
Str = " " & Str
For X = Len(Str) To 2 Step -1
If Mid(Str, X - 1, 1) <> " " Then Mid(Str, X, 1) = " "
Next
FirstLetters = Replace(Str, " ", "")
End Function

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top