Thread
:
Replace "FIRSTNAME LASTNAME" with "LAST"
View Single Post
#
6
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1530_]
external usenet poster
Posts: 1
Replace "FIRSTNAME LASTNAME" with "LAST"
With VBA:
Sub lastname()
s = Split(ActiveCell.Value, " ")
u = UBound(s)
MsgBox (Left(s(u), 4))
End Sub
Another way...
MsgBox Left(Mid(ActiveCell.Value, InStrRev(ActiveCell.Value, " ") + 1), 4)
Rick
Reply With Quote
Rick Rothstein \(MVP - VB\)[_1530_]
View Public Profile
Find all posts by Rick Rothstein \(MVP - VB\)[_1530_]