如何打印在VBA中立即窗口二维数组? [英] How to print two dimensional array in Immediate window in VBA?

查看:1257
本文介绍了如何打印在VBA中立即窗口二维数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何打印在VBA中立即窗口二维数组?是否存在这样做的一般方法?有些方法在ploting立即窗口每行阵列的一行可以解决这个问题,因为这时唯一能做的是循环这个code数组的每一行。

How to print two dimensional array in Immediate window in VBA ? Does it exist any generic method for doing this ? Some method for ploting one row of array per line in Immediate window could solve this problem, because then only thing to do is to loop this code for each line of array.

推荐答案

我做了一个简单的循环,为任何人的参考做到这一点:

I made a simple loop to do this for anybody's reference:

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

这篇关于如何打印在VBA中立即窗口二维数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆