Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Please help with VBA code that extracts the last name from a cell containing First name, sometimes middle initial or name, & last name and put into a variable called LastName. For example in cell A1 is the name John B Doe Need LastName variable to contain the word Doe. Thank you so very much. mikeburg -- mikeburg ------------------------------------------------------------------------ mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581 View this thread: http://www.excelforum.com/showthread...hreadid=503728 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike,
For xl2k+, try: '============= Public Sub Tester001() Dim sStr As String Dim Pos As Long sStr = Range("A1").Value Pos = InStrRev(sStr, " ") sStr = Mid(sStr, Pos + 1) MsgBox sStr End Sub '<<============= --- Regards, Norman "mikeburg" wrote in message ... Please help with VBA code that extracts the last name from a cell containing First name, sometimes middle initial or name, & last name and put into a variable called LastName. For example in cell A1 is the name John B Doe Need LastName variable to contain the word Doe. Thank you so very much. mikeburg -- mikeburg ------------------------------------------------------------------------ mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581 View this thread: http://www.excelforum.com/showthread...hreadid=503728 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extract numbers from a code | Excel Worksheet Functions | |||
can i link a variable cost code with a variable sum | Excel Discussion (Misc queries) | |||
Extract a number from a variable text string | Excel Discussion (Misc queries) | |||
Code Post: Extract Trendline coefficients | Excel Discussion (Misc queries) | |||
Extract a cells format and apply to a variable | Excel Programming |