发布网友 发布时间:2022-04-25 20:41
共1个回答
热心网友 时间:2022-06-17 06:01
数组作为入参的例子如下:
按地址传递byref
Sub AAATest()
Dim StaticArray(1 To 3) As Long
Dim N As Long
StaticArray(1) = 1
StaticArray(2) = 2
StaticArray(3) = 3
PopulatePassedArray Arr:=StaticArray
For N = LBound(StaticArray) To UBound(StaticArray)
Debug.Print StaticArray(N)
Next N
End Sub
Sub PopulatePassedArray(ByRef Arr() As Long) 这里是数组入参
Dim N As Long
For N = LBound(Arr) To UBound(Arr)
Arr(N) = N * 10
Next N
End Sub