Option Explicit
Type a
a(2, 4) As Integer
End Type
Public Function test() As a
Dim i As Integer, j As Integer
For i = 1 To 2
For j = 1 To 4
test.a(i, j) = i * j
Next j
Next i
End Function
Sub hj1()
Dim i As Integer, j As Integer
For i = 1 To 2
For j = 1 To 4
ActiveCell.Offset(0, j - 1).Value = test.a(i, j)
Next j
ActiveCell.Offset(1, 0).Range("a1").Select
Next i
End Sub
虽然没分,我还是送给你了
数组可以作为函数类型?貌似Variant类型,可以是数组。
Dim hj(2, 4) As Integer 改成 Dim hj(1 to 2, 1 to 4)