View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
VB_Sam VB_Sam is offline
external usenet poster
 
Posts: 4
Default Create Acronym (Extract first letter of each word)

Thanks for the macro.
Is it possible to create a UDF (custom function) instead so I can use it
anywhere and can do dynamic update?

A1: I am a boy
B1: Acronym(A1)
B1 answer is IAAB

If I change the cell in A1, the function will auto-update itself.
Thanks a lot.


"ShaneDevenshire" wrote:

Hi,

The following modification of my previous macro will allow you to select a
column of item and it will put the results in the column to the right for all
the selected cells.

Sub Shorten()
Dim T As Range, I As Integer, myWord As String
For Each cell In Selection
E = cell
myWord = Left(E, 1)
For I = 2 To Len(cell)
If Mid(E, I, 1) = " " Then
myWord = myWord & Mid(E, I + 1, 1)
End If
Next I
cell.Offset(0, 1) = myWord
Next cell
End Sub

--
Cheers,
Shane Devenshire


"VB_Sam" wrote:

How can I extract first letter of each word in Excel XP?

For example:
I am a boy
You are a girl

Using the pseudo-function called acronym(), the result will become:
IAAB
YAAG

I'm using Excel XP.
Is there any function which can do it?
If not, could anyone provide a macro for me?
(I'm only a beginner in macro)

Thanks.