Dim S As String, AR As Variant, i As Integer
For ROW = 1 to 100
S = Range("A"&ROW)
AR = Split(S, " ")
S = ""
For i = 1 To 2
S = IIf(S = "", "", S & " ") & AR(i)
Next
MsgBox S
S = ""
For i = 4 To 6
S = IIf(S = "", "", S & " ") & AR(i)
Next
MsgBox S
Range("B"&Row).value= S
Range("C"&Row).value= S
Next作者: ashan0418 時間: 2014-12-12 11:24
For Row = 1 To 100
S = Range("A" & Row)
AR = Split(S, " ")
S = ""
For i = 1 To 2 '抓第1個空格到第2格空格的字串
On Error Resume Next '//////////忽略錯誤
S = IIf(S = "", "", S & " ") & AR(i)
Next
Range("B" & Row).Value = S
S = ""
For i = 4 To 6 '抓第四個空格到第六格空格的字串
S = IIf(S = "", "", S & " ") & AR(i)
Next
Range("C" & Row).Value = S
Next作者: GBKEE 時間: 2014-12-12 19:44