Thread: Name Macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Name Macro

You don't need a macro

=MID(A1,FIND(" ",A1)+1,99)

in B1 will get the surname, and copy down.

If you must have a macro

For Each cell In Selection
cell.Offset(0,1).Value = mid(Range("A1"),Instr(Range("A1")," ")+1, _
len(Range("A1"))-Instr(Range("A1"),"
"))
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt" wrote in message
...
Hi,

I have a column that has the first and last name separated by a space in
that column. Is there a way to write a macro to place the last name in a
different column?

Thanks!!

-Matt