|
楼主 |
发表于 2017-8-26 09:45
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
謝謝sqrall900的回覆,請試試看如何偵測下列代碼的兩個For循環的4及1。謝謝。
Sub 將二維JSON數組寫入單元格()
Dim JsStr As String
Dim Js As String
Dim i As Integer
Dim j As Integer
JsStr = "{""data3"":[[""1"",""A""],[""2"",""B""],[""3"",""C""],[""4"",""D""],[""5"",""E""]]}"
'撰寫JAVA函數
Js = "function j(s,i,j){return eval('(' + s + ').data3[' + i + '][' + j + ']');}"
With CreateObject("MSScriptControl.ScriptControl")
.Language = "JScript"
.AddCode Js
For i = 0 To 4
For j = 0 To 1
Cells(i + 1, j + 1) = .Run("j", JsStr, i, j)
Next j
Next i
End With
End Sub |
|