View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Remove Middle Initial

Maybe this is simpler:

Function remmiddle(wholestr)
Dim joinarr()
splitarr = Split(wholestr, " ")
meret = UBound(splitarr)
j = 0
For a = 0 To meret
If Len(splitarr(a)) 1 Then
ReDim Preserve joinarr(j)
joinarr(j) = splitarr(a)
j = j + 1
End If
Next a
remmiddle = Join(joinarr)
End Function

Regards,
Stefi


ezt *rta:

Hey Anyone,

I have a range that contails several names such as:

Smith, John D
Dean, James L & Mouse, Mickey M
Trump, Donald
Wayne, John P
Wayne, Bruce

I am trying to remove all the middle initials, which as you can see,
some cells contain a name with no middle initials, and some cell
contain 2 names each with an initial. I'm wondering what the code
would look like to search each cell in the range for a single
character (ie. the middle initial), ignoring "&", and remove the
initial.

Any help would be much appreciated.

Thank You,
Kyle