On Thu, 23 Aug 2007 03:46:19 -0700, Tania
wrote:
I need the formula for alpha code for example the woord First National Bank
code is FNB now what's the code or formula you put in to change that to that.
The following should return the first alpha-numeric character of each word in a
string, all capitalized.
First enter the UDF below. To do that, <alt-F11 opens the
VB Editor. Ensure
your project is highlighted in the Project Explorer window, then Insert/Module
and paste the code below into the window that opens.
Then use this formula:
=UPPER(recode(A1,"(\w).*?(\s|$)","$1"))
Substitute your cell_reference for A1.
===============================
Option Explicit
Function ReCode(str As String, sPtrn As String, sRepl As String) As String
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = sPtrn
ReCode = re.Replace(str, sRepl)
End Function
=================================
--ron