Extracting Words from Cells

T

Tommy

I would like to extract the last names from a group of cells
containing a first and last name and place them into a separate
column. Is there an easier way to accomplish this other than
highlghting the last name and using cut&paste to move into the new
cell?
 
M

merjet

If each cell is only two names (first & last, no "Jr.", etc.) it's
pretty easy.

Dim c As Range
Dim rng As Range
Dim iPos As Integer
'change next line to suit
Set rng = Sheets("Sheet1").Range("A1:A10")
For Each c In rng
iPos = InStr(c, " ")
'extract last name and put in col B
c.Offset(0, 1) = Right(c, Len(c) - iPos)
Next c

Hth,
Merjet
 
G

Guest

If the first and last names are separated by a space and/or a comma, then
consider using Text to Columns
 

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