I've created a userform that allows people to enter their name, an item description and then they can choose two characteristics of their item based on combo boxes on the userform. I then built another userform to allow for finding previous entries and the user would search on the names that were previously entered. I wanted to have that list of names sorted alphabetically by last name, but the names are entered as one string like:
John Doe
Jane White
Tarzan Smith
To sort in Excel I'd have to delimit the names and touch the data so I was hoping to have VBA break the strings and put them back together and then sort them. This lead me to regular expressions in VBA and I've been able to break out the first and last names with a UDF I wrote. Now I just need to figure out how to take a list of names, have the two functions apply to each name, then take the results of two functions and put the names back together like (last name, first name possible middle initial or middle name) and sort them to be used by the combo box as the list.
The names are in a range named "Entered_Names" on the sheet "Sign-Up List". I'm not sure what to do now that I can break the name segments down. Seems like I need a "For Each" loop looking at the name list, breaking down each name and saving the new combination into a VBA array, then sort that array and populate a combo box with the results. I'm fine with having the results pasted somewhere for reference but I don't think it is necessary for Excel, it would just make validation of the results easier.
Any help would be appreciated and I'm not afraid to read so links are welcome too.
Thanks,
John Doe
Jane White
Tarzan Smith
To sort in Excel I'd have to delimit the names and touch the data so I was hoping to have VBA break the strings and put them back together and then sort them. This lead me to regular expressions in VBA and I've been able to break out the first and last names with a UDF I wrote. Now I just need to figure out how to take a list of names, have the two functions apply to each name, then take the results of two functions and put the names back together like (last name, first name possible middle initial or middle name) and sort them to be used by the combo box as the list.
The names are in a range named "Entered_Names" on the sheet "Sign-Up List". I'm not sure what to do now that I can break the name segments down. Seems like I need a "For Each" loop looking at the name list, breaking down each name and saving the new combination into a VBA array, then sort that array and populate a combo box with the results. I'm fine with having the results pasted somewhere for reference but I don't think it is necessary for Excel, it would just make validation of the results easier.
Any help would be appreciated and I'm not afraid to read so links are welcome too.
Thanks,