Extract First Letter from each word in a Text String
This should do what you want...
Function GetFirstLetters(S As String) As String
Dim X As Long
Dim Words() As String
Words = Split(S)
For X = 0 To UBound(Words)
GetFirstLetters = GetFirstLetters & Left(Words(X), 1)
Next
End Function
--
Rick (MVP - Excel)
"Casey" wrote in message
...
Rick,
Thank you for the reply. The procedure works exactly as needed. Could this
procedure be made into a Function?
--
Casey
"Rick Rothstein" wrote:
This macro will process all selected cells and put the abbreviations into
the next column...
Sub GetFirstLetters()
Dim X As Long
Dim C As Range
Dim S As String
Dim Words() As String
For Each C In Selection
Words = Split(C.Value)
S = ""
For X = 0 To UBound(Words)
S = S & Left(Words(X), 1)
Next
C.Offset(0, 1).Value = S
Next
End Sub
--
Rick (MVP - Excel)
"Casey" wrote in message
...
I have a single cell formatted as text into which a variety of
information
might be entered. What I want to do is extract the first letter of each
word
into another cell.
Examples:
A1
A2
Basalt Regional Library BRL
Carbondale Rural Fire Protection District CRFPD
Williams Residence WR
--
Casey
|