bobkap
Active Member
- Joined
- Nov 22, 2009
- Messages
- 313
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
I have a list of names where both first and last name is separated by a comma. I need to have the last name in one column and the first in another. I think I've figured out how to do that with this code below. Except I cannot figure out how to address two things.
1. If the person's first name is two words (ex.: Billy Joe; or Bobby Sue etc) I end up with 3 columns, not 2. I thought the "consecutive delimeter" would address that but it does not. Might anyone know how to handle that please?
2. Smith, Mary keeps the comma such as "Smith," in the column for the last name. Is there some easy way I can get rid of that comma?
Any help would be greatly appreciated!
1. If the person's first name is two words (ex.: Billy Joe; or Bobby Sue etc) I end up with 3 columns, not 2. I thought the "consecutive delimeter" would address that but it does not. Might anyone know how to handle that please?
2. Smith, Mary keeps the comma such as "Smith," in the column for the last name. Is there some easy way I can get rid of that comma?
Range(Cells(1, carename), Cells(finalrow, carename)).TextToColumns Destination:=Range("a1"), consecutivedelimiter:=True, DataType:=xlDelimited, Space:=True
Any help would be greatly appreciated!