Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Extract First Letter from each word in a Text String

And you are saying the function provides a #NAME? error for you? You did
pick Module and not "Class Module", correct? If your answer is yes to both
of those, then I'm not sure what to tell you as the function works fine on
my system. You might try closing Excel down and reopening it to see if that
clears whatever is blocking the UDF from working for you.

--
Rick (MVP - Excel)


"Casey" wrote in message
...
I inserted a new Module and placed the code in that Module.
--
Casey




"Rick Rothstein" wrote:

Where did you put the code at? UDFs must be placed in a Module
(Insert/Module from the VB editor's menu bar).

--
Rick (MVP - Excel)


"Casey" wrote in message
...
Rick,
Thank you again for the effort. But I must be using the function wrong,
it
is throwing a #NAME? error. I entered the function in a blank cell
pointing
to the cell with the text string, like so: =GetFirstLetters (C10).
--
Casey




"Rick Rothstein" wrote:

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









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
Create Acronym (Extract first letter of each word) VB_Sam Excel Worksheet Functions 20 April 24th 23 09:05 PM
Greek Letter as a Text String raj74 Charts and Charting in Excel 3 June 23rd 09 10:16 PM
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
Formula to extract a specific word from text string Dinesh Excel Worksheet Functions 4 November 3rd 06 08:35 PM
How do I extract a word from a string? Gabe Tiger Excel Programming 4 July 14th 06 03:52 PM


All times are GMT +1. The time now is 10:26 AM.

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"