Excel VBA function to print an array to the workbook

后端 未结 6 1758
心在旅途
心在旅途 2020-12-10 03:17

I\'ve written a macro that takes a 2 dimensional array, and \"prints\" it to equivalent cells in an excel workbook.

Is there a more elegant way to do this?



        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-10 04:05

    Create a variant array (easiest by reading equivalent range in to a variant variable).

    Then fill the array, and assign the array directly to the range.

    Dim myArray As Variant
    
    myArray = Range("blahblah")
    
    Range("bingbing") = myArray
    

    The variant array will end up as a 2-D matrix.

提交回复
热议问题