View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey[_72_] ExcelMonkey[_72_] is offline
external usenet poster
 
Posts: 1
Default Max of VBA Array

So to expand on this further, lets now way that my array has 5
dimensions. I fill the array with values within 5 imbedded For Next
Loops. Assume I use the rnd() function to fill them for simplicity.
Once I have filled all the rows and columns in the first two dimensions
(i.e. rows and columns) I want to sum all the data in column 9. The
following is not working. It is giving me a Type Mismatch Error for
ArrayMax.

Private Sub Other()
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
Dim Array1() As Variant
Dim ArrayMax As Variant

ReDim Array1(1 To 9, 1 To 13, 1 To 5, 1 To 5, 1 To 5)
For A = 1 To 5
For B = 1 To 5
For C = 1 To 5
For D = 1 To 13
For E = 1 To 9
Array1(E, D, C, B, A) = Rnd()
Next E
Next D
ArrayMax = Application.Max(Application.Index(Array1, 0, 9, 0, 0, 0))
Next C
Next B
Next A

End Sub


---
Message posted from http://www.ExcelForum.com/