title: Excel VBA - application.index function
body: <p>Could anyone help me when and why I have to use the <code>application.index</code> in the VBA? </p>
  
  <pre><code>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
  </code></pre>