View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Inserting and deleting spaces with a macro

Assuming the only comma and space are as indicated, this UDF should do it.

Public Function FixName(argRange As Range) As String
FixName = Replace(Split(argRange, " ")(0), ",", ", ")
End Function

You should add error checking to ensure that argRange is a single cell.

NickHK

"crowdx42" wrote in
message ...

Ok,
so I have names in a column which I want to both insert a space after
a "," and then delete everything after the second word space. i.e
James,Patrick Coogan needs to be
James, Patrick
Can this be done?
Thanks in advance
You guys have been very patient and I very much appreciate all the
help.
Patrick:)


--
crowdx42
------------------------------------------------------------------------
crowdx42's Profile:

http://www.excelforum.com/member.php...o&userid=37749
View this thread: http://www.excelforum.com/showthread...hreadid=574054