View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default create new column with last name

Hi Bufhal,

Try something like:

'=============
Public Sub Tester007()
Dim rng As Range
Dim rCell As Range
Dim arr As Variant
Const sSeparator As String = " " '<<==== CHANGE

Set rng = Selection

For Each rCell In rng.Cells
With rCell
arr = Split(.Value, sSeparator)
.Offset(0, 1).Value = arr(UBound(arr))
End With
Next rCell

End Sub
'<<=============

This assumes the names are separated with a space. If the separator differs,
amend the value os the sSeparator variable accordingly.


---
Regards,
Norman


"bufhal" wrote in
message ...

Hope someone can help.
I have a list of first, middle initial and last names in one
column(about 200 records). I want to pull the last name out and put it
into a new column so it can sorted by last name.
Can someone offer any guidance?
I appreciate it.


--
bufhal
------------------------------------------------------------------------
bufhal's Profile:
http://www.excelforum.com/member.php...o&userid=10702
View this thread: http://www.excelforum.com/showthread...hreadid=517584