View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Separating words in a single cell

Create an UDF (User Defined Function) in a module with following code:

'----------------------------------------------------
Function FirstLast(sText As String) As String
Dim re As RegExp
If re Is Nothing Then
Set re = New RegExp
re.Pattern = "([A-Z][a-z]*)([A-Z][a-z]*)"
re.IgnoreCase = False
re.Global = True
End If

FirstLast = re.Replace(sText, "$1 $2")
End Function
'---------------------------------------------------------------------

Add a reference to Microsoft VBScripr Regular Expressions 1.0

Enter following formula in worksheet:

=FirstLast(A1)

That should do it!

Cheers,
--
AP

"ibere" a écrit dans le
message de news: ...

Bob, thanks.

I'm writing in the forum and I put the words in bold, so I think it
turnet into all capitals in the usenet group, but all names are in the
format like JohnSmith.


--
ibere
------------------------------------------------------------------------
ibere's Profile:
http://www.excelforum.com/member.php...o&userid=35455
View this thread: http://www.excelforum.com/showthread...hreadid=552319