How to split a string with multiple delimiters in vba excel?

后端 未结 6 910
终归单人心
终归单人心 2021-01-01 14:53

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 tw

6条回答
  •  盖世英雄少女心
    2021-01-01 15:28

    The previous answer is good, but will cause you to have trouble if there are back to back characters to be split on that are in the String, such as splitting "Hello, Sir! How are you doing, today?" on all punctuation and spaces. In this case, you would get a blank string between Hello and Sir.

    To handle this scenario Chip Pearson provides a great VBA function for use: http://www.cpearson.com/excel/splitondelimiters.aspx

提交回复
热议问题