leb.james
leb.james

Reputation: 13

vba print out an three dimension data

how to display a 3-dimension array without knowing its exactsize? If the variable name is DataSet. But I'm not sure the height and the length. In Macro,

msgbox(DataSet) 'type mismatch
msgbox(DataSet(0,0,0))'subscript out of range

or give general example. Appreciate your help, thanks.

Upvotes: 0

Views: 32

Answers (1)

Dave
Dave

Reputation: 4356

You can always nest a For loop as such:

For d1 = 0 to Ubound(myArray,1)
    For d2 = 0 to UBound(myArray,2)
        For d3 = 0 to UBound(myArray, 3)
            sValue = sValue & vbNewLine & myArray(d1, d2, d3)
        Next
    Next
Next
MsgBox sValue

Upvotes: 1

Related Questions