Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default How can I do this with VBA?

Assume name is in cell A1 then .........

xname = Trim(Range("A1"))

MsgBox Left(xname, InStr(1, xname, " ")) & Right(xname, InStrRev(xname, "
") - 2)

This assumes there is at least one space between the salutation, first and
last name. If the name is formatted without a space after the salutation,
e.g.
Mr.Jack Adams, then use..........

MsgBox Left(xname, InStr(1, xname, ".")) & Right(xname, InStrRev(xname, "
") - 1)


--
Cheers
Nigel



"slamm" wrote in
message ...

For instance, I have " Mr. Jack Adam" and I want to trim the first name
and have "Mr. Adam" left.

How can I do that?


Thanks a lot.



slamm


--
slamm
------------------------------------------------------------------------
slamm's Profile:

http://www.excelforum.com/member.php...o&userid=15018
View this thread: http://www.excelforum.com/showthread...hreadid=483829



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"