我想在vba中创建一个具有数组作为参数的Sub。以下代码有效:

Sub phase1State(ByRef arr() As String)


现在,我希望该参数是数组数组或锯齿状数组,我该怎么做?

谢谢!

最佳答案

Sub test()
    Dim jagged As Variant
    ReDim jagged(1 To 3)
    jagged(1) = Array(1, 2, 3)
    jagged(2) = Array(4, 5, 6)
    jagged(3) = Array(7, 8, 9)
    phase1State jagged
End Sub

Sub phase1State(ByRef arrJagged As Variant)
    Debug.Print arrJagged(2)(2) ' 6
End Sub

10-05 23:34