user3670330
user3670330

Reputation:

how to split a string with multiple delimeters in vba?

I am trying to split a string. I am using the split function, but I am unable to do for multiple delimiters.

Course Details = Split("ENM/5200-Fall2014/aba","/")

Upvotes: 0

Views: 1156

Answers (1)

xQbert
xQbert

Reputation: 35323

Consider using the replace function to change the - to / (assuming the - isn't used in other text)

for if you just have -

Split(Replace("ENM/5200-Fall2014/aba", "-", "/"), "/")

for if you have - and ( and ) it drops the )'s and only looks at the - (, but if we need to we can alter it so the "" has ")" to replace with "/" as well

Split(Replace(Replace(Replace("ENM/5200-Fall2014(aba)", "-", "/"),"(","/"), ")",")"), "/")

Upvotes: 1

Related Questions