how to split a string with multiple delimeters in vba excel?

calendar_today Asked Oct 6, 2011
thumb_up 20 upvotes
history Updated April 16, 2026

Question posted 2011 · +7 upvotes

I want to split a string with multiple delimeters using Excel VBA. One of the strings is:

d1-d2 d3 d4  

We have a dash and a space as two delimeters. I tried the split function but it only does it with one delimeter.

Accepted answer +20 upvotes

You could first do a REPLACE on the string first and then do the split:

newString = Replace(origString, "-", " ")
newArray = SPlit(newString, " ")

Top vba Q&A (6)

+20 upvotes ranks this answer #19 out of 81 vba solutions on this site — top 23%.
vba