excel vba- extract text between 2 characters

前端 未结 4 868
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 15:35

If i had this column:

ColA
-----
NUMBER(8,3)
NUMBER(20)

I need a VBA function that would go (note these start and end string would only eve

4条回答
  •  醉话见心
    2020-12-01 16:05

    If the string is “Value of A is [1.0234] and Value of B is [3.2345]”

    If you want to extract the value of B i.e., 3.2345, then

    firstDelPos = InStrRev(textline, “[“) ‘ position of start delimiter
    secondDelPos = InStrRev(textline, “]”) ‘ position of end delimiter
    
    stringBwDels = Mid(textline, firstDelPos + 1, secondDelPos – firstDelPos – 1) ‘ extract the string between two delimiters
    
    MsgBox (stringBwDels) ‘ message shows string between two delimiters
    

提交回复
热议问题