![]() |
Name Macro
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 |
Name Macro
data=Text to columns
-- Regards, Tom Ogilvy "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 |
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 |
Name Macro
Thanks, that did the trick!!
"Bob Phillips" wrote: 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 |
All times are GMT +1. The time now is 10:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com