我正在将一行文本拆分成一个数组,然后尝试放入一个没有空格的新数组。由于某种原因,它不是从旧阵列复制到新阵列。顺便说一句,如果某人有更有效的方式这样做,我也愿意这样做。
Dim x As Variant, i As Integer, m As String, rdate As String, k(0 To 50) As Variant, j As Integer
rdate = ThisWorkbook.Sheets("sheet1").Range("a58").Value
j = 0
x = Split(rdate, " ")
For i = 0 To UBound(x)
If x(i) <> "" Then
k(j) = x(i)
j = j + 1
m = m & j & k(j) & vbCrLf
End If
Next
MsgBox m
答案 0 :(得分:1)
您的脚本正在添加k(j)
后递增j
...您的msgbox显示为空。