答案 0 :(得分:0)
这是一个让你入门的例子。
此代码将采用您突出显示的活动单元格,并按空格分解字符串,将其扩展到第1行中的列。
示例:
代码将执行,您现在将拥有" Hello"在A1,"世界"在A2中,"测试"在A3
Sub Example()
Dim txt As String
Dim i As Integer
Dim fullname As Variant
txt = ActiveCell.Value
fullname = Split(txt, " ")
For i = 0 To UBound(fullname)
Cells(1, i + 1).Value = fullname(i)
MsgBox fullname(i)
Next i
End Sub