Changing Cell Contents

O

Orion Cochrane

I have an employee list with names (First Last) in one column. Is there a way
to get the last name to show up first and then the first name? TIA.
 
G

Gary''s Student

Assuming that the names are in a single cell searated by a single blank,
select the cells and run this macro:

Sub swapum()
For Each r In Selection
s = Split(r.Value, " ")
r.Value = s(1) & " " & s(0)
Next
End Sub
 
J

JE McGimpsey

One way:

A1: First Last
B1: =TRIM(MID(A1,FIND(" ",A1)+1,255) & ", " & LEFT(A1,FIND(" ", A1)-1)
 
O

Orion Cochrane

Tried the formula route, and it works awesome! Thanks. I can use this
elsewhere I bet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top