「VBA」Split()で文字列を分割するサンプル
書式
Split(配列名,区切り文字)
使用例
Sub funcA() Dim resA As Variant Dim strP As String strP = "A001, B002, C003,D004" resA = Split(strP, ",") For Each c In resA Debug.Print c Next End Sub
実行結果
A001 B002 C003 D004
Coding Changes the World
書式
Split(配列名,区切り文字)
使用例
Sub funcA() Dim resA As Variant Dim strP As String strP = "A001, B002, C003,D004" resA = Split(strP, ",") For Each c In resA Debug.Print c Next End Sub
実行結果
A001 B002 C003 D004