drakuz1965
Technical User
Here is what I am trying to accomplish:
Example: Doe, J ohn Lynn
Wanted outcome: Doe, John Lynn
For the most part this is working fine but I can't get the middle name to work in all scenarios. Sometimes the last name will not have a space in the name. Need help with a better way of doing this. Here is my code. "Tab" holds the value of the persons name.
-----------------------------------------------------------
Dim currentStr, newStr, lName, fName, mName
newStr = Tab
newStr = Split(newStr, ",")
lName = newStr(0)
fName = newStr(1)
mName = Split(fName, " ")
lName = DeleteChars(newStr(0), " ")
fName = DeleteChars(newStr(1), " ")
Tab = lName & ", " & mName(1) & mName(2) & " " & mName(3)
----------------------------------------------------
Example: Doe, J ohn Lynn
Wanted outcome: Doe, John Lynn
For the most part this is working fine but I can't get the middle name to work in all scenarios. Sometimes the last name will not have a space in the name. Need help with a better way of doing this. Here is my code. "Tab" holds the value of the persons name.
-----------------------------------------------------------
Dim currentStr, newStr, lName, fName, mName
newStr = Tab
newStr = Split(newStr, ",")
lName = newStr(0)
fName = newStr(1)
mName = Split(fName, " ")
lName = DeleteChars(newStr(0), " ")
fName = DeleteChars(newStr(1), " ")
Tab = lName & ", " & mName(1) & mName(2) & " " & mName(3)
----------------------------------------------------