Fill Textbox from cell

  • Thread starter Thread starter V. Roe
  • Start date Start date
V

V. Roe

Hi,
I need to fill two textboxes on a userform with information from one cell.
In Range ("ClientName") is text "Last, FirstName". I need to fill Textbox1
with "LastName" and Textbox2 with the "FirstName". I have no problem
filling the textbox with the entire text from the cell, but I have no idea
how to split the information at the comma. The only information I could
find suggested using the Left function, but since the number of characters
can vary that didn't work too well. Any help would be greatly appreciated.
Thanks
Valerie
 
Valerie

Try this: for last name =LEFT(ClientName,FIND(", ",ClientName)-1)
and for first name =RIGHT(ClientName,FIND(",",ClientName)-2)
That is dependant on names being separated by comma then space, if no comma
then in the formulas instead of comma between inverted commas, use a space
and perhaps alter the numbers to suit

Regards
Philip
 
Left(ClientName, WorksheetFunction.Find(",", ClientName) - 1) and
Right(ClientName, Len(ClientName) - WorksheetFunction.Find(",", ClientName)
- 1)
 
Thanks to both of you this worked great.

bigwheel said:
Left(ClientName, WorksheetFunction.Find(",", ClientName) - 1) and
Right(ClientName, Len(ClientName) - WorksheetFunction.Find(",", ClientName)
- 1)
 

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

Back
Top