任何人都可以帮助我何时以及为什么必须在VBA中使用application.index
?
Function elso(bemenet)
Dim kimenet(), koztes() As Variant
Dim i, j, n, m, k As Long
Dim sarok As Double
elso = 1
n = bemenet.Rows.count
m = bemenet.Columns.count
ReDim kimenet(n + 1, m + 1)
For i = 1 To n
For j = 1 To m
kimenet(i, j) = bemenet(i, j)
Next j
Next i
For i = 1 To n
kimenet(i, m + 1) = Application.max(Application.Index(bemenet, i, 0))
Next i
For j = 1 To m
kimenet(n + 1, j) = Application.Average(Application.Index(bemenet, 0, j))
Next j
For k = 1 To Application.max(n, m)
sarok = sarok + (bemenet(k, k))
Next k
kimenet(n + 1, m + 1) = sarok
elso = kimenet
End Function
答案 0 :(得分:0)
似乎是从工作表中获取存储在内存中的特定值。请参阅https://usefulgyaan.wordpress.com/2013/06/12/vba-trick-of-the-week-slicing-an-array-without-loop-application-index/
答案 1 :(得分:0)
这是一个工作表函数,用于从范围中提取值。相同的功能如下:
Application.Index(Array, Row_Number, Column_Number)
Application.WorksheetFunction.Index(Array, Row_Number, Column_Number)