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

后端 未结 6 1118
别那么骄傲
别那么骄傲 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:49

    I wrote my own function for this. print_r() for VBA. It can evaluate Arrays, Dictionaries, Collection, MatchCollection etc.. The whole also nested. In addition, the data types are given and special characters are displayed in strings as Unicode.

    http://wiki.yaslaw.info/doku.php/vba/functions/print_r/index

    print_r(array(1,2,3,array("A","B")))
      (
        [0] =>  1
        [1] =>  2
        [2] =>  3
        [3] =>   (
            [0] =>  'A'
            [1] =>  'B'
        )
    )
    
    print_r([{1,2;3,4}])
      (
        [1.1] =>  1
        [1.2] =>  2
        [2.1] =>  3
        [2.2] =>  4
    )
    

提交回复
热议问题