[VBA]半角スペースで文字列を分割するサンプル
書式
Split(文字列," “)
使用例
Sub funcA() Dim resA As Variant Dim strP As String strP = "AA01 BB02 CC03 DD04" resA = Split(strP, " ") For Each g In resA Debug.Print g Next End Sub
実行結果
AA01 BB02 CC03 DD04
Coding Changes the World
書式
Split(文字列," “)
使用例
Sub funcA() Dim resA As Variant Dim strP As String strP = "AA01 BB02 CC03 DD04" resA = Split(strP, " ") For Each g In resA Debug.Print g Next End Sub
実行結果
AA01 BB02 CC03 DD04