Excel VBA – split Function
Sub SplitBasic() Dim arr() As String ' 定義一個陣列 arr = Split("Apple:Orange:Banana", ":") '用 : 來分隔 End Sub Sub VBA_Split_Print() Dim arr() As String ' Split the string to an array arr = Split("John:Jane:Paul:Sophie", ":") ' Print each item in the array to the Immediate Window(Ctrl + G) Dim name As Variant For Each name In arr Debug.Print name Next End Sub