I want to split a string with multiple delimiters using Excel VBA. One of the strings is:
d1-d2 d3 d4
We have a dash and a space as two delimiters. I tried the split
function but it only does it with one delimiter.
The Microsoft Excel SPLIT function will split a string into substrings based on a delimiter. The result is returned as an array of substrings. The SPLIT function is a built-in function in Excel that is categorized as a String/Text Function. It can be used as a VBA function (VBA) in Excel.
You could first do a Replace
on the string first and then do the split:
newString = Replace(origString, "-", " ")
newArray = Split(newString, " ")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With