Excel VBA - application.index函数

时间:2016-05-25 18:46:58

标签: vba excel-vba excel

任何人都可以帮助我何时以及为什么必须在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

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

这是一个工作表函数,用于从范围中提取值。相同的功能如下:

Application.Index(Array, Row_Number, Column_Number)

Application.WorksheetFunction.Index(Array, Row_Number, Column_Number)