office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

Split函数的使用方法

2019-11-16 01:30:00
zstmtony
原创
582
Sub test1()
    Dim strTest As String
    Dim arrResult() As String
    Dim i As Integer
    strTest = "abc, edf, hij, klm"
    arrResult = VBA.Split(strTest , ",", 3)
    For i = LBound(arrResult) To UBound(arrResult)
        Debug.Print Trim(arrResult(i))
    Next i
End Sub


文本不区分大小写


Sub test2()
    Dim strTest As String
    Dim arrResult() As String
    Dim i As Integer
    strTest = "AAAsBBBSCCCsDDDsEEEFF"
    arrResult = VBA.Split(strTest , delimiter:="s", compare:=vbTextCompare)
    For i = LBound(arrResult) To UBound(arrResult)
        Debug.Print Trim(arrResult(i))
    Next i
End Sub


分享