From: laavista on
This is great. Thanks so much!

"Rick Rothstein" wrote:

> There are a couple of ways you can do this. Assuming this assignment....
>
> CellName = Range("A1").Value
>
> you can do either this...
>
> LastName = Split(CellName, ",")(0)
>
> or this...
>
> LastName = Left(CellName, InStr(CellName, ",") - 1)
>
> your choice.
>
> --
> Rick (MVP - Excel)
>
>
>
> "laavista" <laavista(a)discussions.microsoft.com> wrote in message
> news:2694E4E6-6138-480A-8267-B6EA0E53A18E(a)microsoft.com...
> > I know this has to be a common question, but I can't find the answer...
> >
> > Using VBA, I need to extract the last name from the format:
> > Last, First
> >
> > For example:
> > the cell contents extract to a variable the value of
> > JONES, AMY JONES
> > ADAMS, HARRY ADAMS
> >
> > Your help would really be appreciated!
>
> .
>
From: (PeteCresswell) on
Per laavista:
>
>Using VBA, I need to extract the last name from the format:
> Last, First
>
>For example:
>the cell contents extract to a variable the value of
>JONES, AMY JONES
>ADAMS, HARRY ADAMS

Feasibility depends on your data and how often you need to do it

If it's just a few mostly straight-up names, others' solutions
apply.... and you can manually correct the exceptions.

If there are a *lot* of names and/or you have to do it often be
advised that the Mc's, the Mac's, the Di's the D's, the II's, the
III's, the IV's, the Phd's and a whole host of others will drive
you nuts - not to mention people with on-letter last names...

Lookup tables will be involved...
--
PeteCresswell
First  |  Prev  | 
Pages: 1 2
Prev: odbc connection lost
Next: Ribbon Customisation