View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Split astring using Capital letter as identifier

I think this UDF does what you want..

Function SplitOnCaps(S As String) As String
Dim X As Long
SplitOnCaps = S
For X = Len(SplitOnCaps) To 2 Step -1
If Mid(SplitOnCaps, X, 1) Like "[A-Z]" Then
SplitOnCaps = Left(SplitOnCaps, X - 1) & " " & Mid(SplitOnCaps, X)
End If
Next
End Function

--
Rick (MVP - Excel)


"Raj" wrote in message
...
Hi,

I am looking for a formula/function/UDF that would split
VasantRamPatil into Vasant Ram Patil ( ie split the string into three
words using the capital letter as the initial letter of each word).
The split can be either by inserting spaces inside the string itself
or splitting the string into three strings).

Thanks in advance for the Help.

Regards,
Raj