From: JLGWhiz on 12 May 2010 20:29 You can use this method to return the last name, no matter how many first and middle names are listed. This returns the last text separated by a space. Sub dj() Dim lnm lnm = Split(Range("B2"), " ", -1) Range("B4") = lnm(UBound(lnm)) End Sub If the name is in B2 it will put the last name in B4. You can work this into a loop for a range of names. "WLMPilot" <WLMPilot(a)discussions.microsoft.com> wrote in message news:3D1390E2-438D-4C4C-B3EB-04E08CAC6A70(a)microsoft.com... > Cell A1 = "John Doe" (without quotes) > > In a macro, I have the following: > name = Range("A1").Value > > How to I pull out just the last name of the person in the variable name > and > place it in the variable, lastname? > > Thanks, > Les
First
|
Prev
|
Pages: 1 2 Prev: Run a macro upon saving Next: Force increased width of GetOpenFilename dialogue box? |