How to print two dimensional array in Immediate window in VBA?

后端 未结 6 1112
别那么骄傲
别那么骄傲 2020-12-30 01:20

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 Immedi

6条回答
  •  离开以前
    2020-12-30 01:52

    Try This

    You can also type code1: code2 instead of code1 _
    This is only for displaying
    If arr is defined as array( array(,),array(,)...)
    and Then
    You shoud For c = Lbound(arr(r),1) to ubound(arr(r),1)
    Debug.Print arr(r)(c)
    Because first is 2d Array and the last is 1nd Array.
    I

    'Define 2d array
    arr = [ {"A",1; "B",2; "C",3 } ]: _
    For r = LBound(arr, 1) To UBound(arr, 1): _
            For c = LBound(arr, 2) To UBound(arr, 2): _
                Debug.Print arr(r, c): _
           Next c: _
    Next
    

提交回复
热议问题