我有一列单元格,如:[[[3,0, [5.0, 6.0]], [6.0, 6,0], [3.0, [6.0, 5.0]]] 我如何拆分它的字符串,以便使用 VBA 将该单元格中的每个数值附加到列表/数组中?
答案1
看一下下面的例子:
Sub Test()
q = "[[[3.0, [5.0, 6.0]], [6.0, 6.0], [3.0, [6.0, 5.0]]]"
Do
w = Len(q)
q = Replace(q, "[[", "[")
q = Replace(q, "]]", "]")
Loop Until w = Len(q)
q = Replace(q, "], [", "|")
q = Replace(q, ", [", "|")
q = Replace(q, "],", "|")
q = Mid(q, 2, Len(q) - 2)
a = Split(q, "|")
End Sub
生成的数组: