我很關心返回數組的函數組成。數組函數的組合
例如,讓我們定義
Function APTranspose(X As Variant) As Variant
Dim v() As Variant
Dim r, c, rc, cc As Integer
r = X.rows.count
c = X.Columns.count
ReDim v(1 To c, 1 To r)
For cc = 1 To c
For rc = 1 To r
v(cc, rc) = X(rc, cc)
Next
Next
APTranspose = v
End Function
和無用的功能
Function Identity(X As Variant) As Variant
Dim res As Variant
res = APTranspose(X)
res = APTranspose(res)
Identity = res
End Function
現在很明顯,功能(X)應該是X本身。
但是我得到#VALUE!在Excel上。一般來說,我不能編寫數組函數。這是爲什麼??
謝謝!
在調用此函數在Excel? –