gpt4 book ai didi

arrays - 如何在VBA的“即时”窗口中打印二维数组?

转载 作者:行者123 更新时间:2023-12-03 15:12:41 27 4
gpt4 key购买 nike

如何在VBA的“即时”窗口中打印二维数组?是否存在执行此操作的通用方法?一种在“即时”窗口中为每行绘制一排数组的方法可以解决此问题,因为唯一要做的就是为数组的每一行循环此代码。

最佳答案

我做了一个简单的循环,以供所有人引用:

Sub WriteArrayToImmediateWindow(arrSubA As Variant)

Dim rowString As String
Dim iSubA As Long
Dim jSubA As Long

rowString = ""

Debug.Print
Debug.Print
Debug.Print "The array is: "
For iSubA = 1 To UBound(arrSubA, 1)
rowString = arrSubA(iSubA, 1)
For jSubA = 2 To UBound(arrSubA, 2)
rowString = rowString & "," & arrSubA(iSubA, jSubA)
Next jSubA
Debug.Print rowString
Next iSubA

End Sub

关于arrays - 如何在VBA的“即时”窗口中打印二维数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14274949/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com