View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Extract First Letter from each word in a Text String

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