|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test()
Path = " M 0 0 C 0.001 0.04533 0.011 0.08667 0.028 0.11333 C 0.028 0.11467 0.055 0.15067 0.055 0.14933" & _
" C 0.07 0.16933 0.079 0.19733 0.079 0.22667 C 0.079 0.28533 0.044 0.332 0 0.33333" & _
" C -0.044 0.332 -0.079 0.28533 -0.079 0.22667 C -0.079 0.19733 -0.07 0.16933 -0.055 0.14933" & _
" C -0.055 0.15067 -0.028 0.11467 -0.028 0.11333 C -0.011 0.08667 -0.001 0.04533 0 0 Z"
Key = Mid(Path, InStr(Path, "C") + 1, InStr(Path, "Z") - InStr(Path, "C") - 1) '取出从C一Z之间的字符串
Key = Replace(Key, " ", " ") '多个空格替换成单个
aa = Split(Key, "C")
ReDim arr(1 To UBound(aa) + 1, 1 To 1)
For i = 0 To UBound(aa)
bb = Split(Trim(aa(i)), " ")
If UBound(bb) + 1 > UBound(arr, 2) Then
ReDim Preserve arr(1 To UBound(aa) + 1, 1 To UBound(bb) + 1)
End If
For j = 0 To UBound(bb)
arr(i + 1, j + 1) = bb(j)
Next j
Next i
Sheet1.[a1].Resize(UBound(arr), UBound(arr, 2)) = arr '数组输出
Sheet1.[a1].Resize(UBound(arr), UBound(arr, 2)).Borders.LineStyle = 1 '加边框线
End Sub
|
|