Excel教程:用Split函数按分隔符拆分文本为数组并写入单元格

本文为:《别怕,Excel VBA其实特别简单(第3版)》随书问题参考答案

Sub 将数组写入单元格()

Dim arr As Variant

arr = Split("别怕@Excel VBA@其实特别简单@叶枫@ExcelHome", "@")

Dim i As Integer

For i = 0 To UBound(arr)

Cells(2 * (i + 1) - 1, "A").Value = arr(i)

Next i

End Sub

AI助手