Split first name and Surname

G

Guest

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top