Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michelle
if you just want to cycle through your records and split them into two columns then this can be done using the Text to Columns feature on the Data menu if you're writing code and need to split the two up then one way is: dim i as integer dim firstName as string dim lastName as string dim fullName as string fullName = Range("A1") 'or whatever to get the fullname i = InStr(fullName, " ") 'returns the number of character that the space relates to firstName = left(fullName, i - 1) 'take the left portion of fullname lastName = right(fullName, len(fullName) - i) 'take the right portion of fullname assumes - all names are in the first name / last name structure and that the full names only have one space in them, hope this helps Cheers JulieD "michelle_ho " wrote in message ... Suppose in cell D3, the value is "Christine White". I have two variables, firstName and lastName as String. How can I separate "Christine White", so that firstName = "Christine" and lastName = "White"?? Thx a lot! --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
separate two dates from a text string into two separate cells | Excel Discussion (Misc queries) | |||
I wish to separate city, state, and zip into 3 separate columns | Excel Worksheet Functions | |||
Open Separate Excel Files in Separate Windows | Excel Discussion (Misc queries) | |||
Save 2 separate data imports in separate worksheets on the same ex | Excel Worksheet Functions | |||
Open Excel files in separate sessions, not just separate windows? | Excel Discussion (Misc queries) |