View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Make a column two columns

The easiest way is to use Text to Columns. Highlight the
names. Choose Data from the menu bar, then Text to
Columns. Choose the Delimited radio button and then Next.
If the name is "Last, First", check the Comma box. If it
is "First Last", choose the Space box. Then Next and
Finish.

VBA-wise, you could use code like this:

If the format is "Last, First"
Sub Sample()
For Each Cell in ActiveSheet.Range("A2:A" &
ActiveSheet.Range("A65536").End(xlup).Row)
Cell.Offset(0,1).Value = Left(Cell,Application.Find
(",", Cell)-1)
Cell.Offset(0,2).Value = Mid(Cell,Application.Find
(", ", Cell)+2)
Next Cell
End Sub

If the format is "First Last"
Sub Sample()
For Each Cell in ActiveSheet.Range("A2:A" &
ActiveSheet.Range("A65536").End(xlup).Row)
Cell.Offset(0,1).Value = Left(Cell,Application.Find
(" ", Cell)-1)
Cell.Offset(0,2).Value = Mid(Cell,Application.Find
(" ", Cell)+1)
Next Cell
End Sub

tod


-----Original Message-----
You can merge first name and last name to make a full

name column, but is there a way to take a full name column
and make it two separate columns, first and last?
.