![]() |
Split first name and Surname
Dear All
I have a column of text made up of surname middle initial,Firstname (i.e Bloggs A,Fred) What I am trying to do is to take the first name and use it in an email function I have created. So I need VB to extract the first name. Can anyone help Regards Newman |
Split first name and Surname
try this, if the name is in cell A1
=RIGHT(A1,LEN(A1)-FIND(",",A1,1)) -- Gary "Newman Emanouel" wrote in message ... Dear All I have a column of text made up of surname middle initial,Firstname (i.e Bloggs A,Fred) What I am trying to do is to take the first name and use it in an email function I have created. So I need VB to extract the first name. Can anyone help Regards Newman |
Split first name and Surname
VB you say?:
firstName = Split(Selection, ",")(1) will work if there's only one comma in the string. And if there are errant spaces after the comma or after the end of the first name then a refinement: firstName = WorksheetFunction.Trim(Split(Selection, ",")(1)) will get rid of them. -- p45cal "Gary Keramidas" wrote: try this, if the name is in cell A1 =RIGHT(A1,LEN(A1)-FIND(",",A1,1)) -- Gary "Newman Emanouel" wrote in message ... Dear All I have a column of text made up of surname middle initial,Firstname (i.e Bloggs A,Fred) What I am trying to do is to take the first name and use it in an email function I have created. So I need VB to extract the first name. Can anyone help Regards Newman |
All times are GMT +1. The time now is 02:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com