我面临的问题是我写的简单代码不起作用。我的办公室是中国办公室,我不知道这是不是原因......
但我已经看到了其他一些代码而不是可以工作的代码。
有效的代码:
Function Test2(Rng As Range) As Range
Set Test2 = Rng
End Function
不起作用的代码:
Function try(a() As Range) As Range
Dim rng As Range
Dim upperbound1 As Integer
Dim upperbound2 As Integer
upperbound1 = UBound(a, 1)
upperbound2 = UBound(a, 2)
ReDim Preserve a(1 To upperbound1, 1 To upperbound2)
rng.Value = a
Set try = rng
End Function