Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create Acronym (Extract first letter of each word) | Excel Worksheet Functions | |||
Greek Letter as a Text String | Charts and Charting in Excel | |||
Change 3 letter text string to a number string | Excel Discussion (Misc queries) | |||
Formula to extract a specific word from text string | Excel Worksheet Functions | |||
How do I extract a word from a string? | Excel Programming |