E
ExcelMonkey
Can't seem to get this to work. I am trying to calculate the min value for
the second column in an array. The printout from my Immediate Window tells
me this value should be 2. However the following line returns a value of 1:
MinRow = Application.WorksheetFunction.Min(Array1, 2)
Sub MakeSenseOfArrays()
Dim Array1 As Variant
Dim MinRow As Integer
ReDim Array1(0 To 1, 0 To 2)
Array1(0, 0) = 1
Array1(0, 1) = 2
Array1(0, 2) = 3
Array1(1, 0) = 10
Array1(1, 1) = 20
Array1(1, 2) = 30
For X = 0 To UBound(Array1, 1)
Debug.Print Array1(X, 0) & " " & Array1(X, 1) & " " & Array1(X, 2)
Next
MinRow = Application.WorksheetFunction.Min(Array1, 2)
End Sub
Immediate Window:
1 2 3
10 20 30
the second column in an array. The printout from my Immediate Window tells
me this value should be 2. However the following line returns a value of 1:
MinRow = Application.WorksheetFunction.Min(Array1, 2)
Sub MakeSenseOfArrays()
Dim Array1 As Variant
Dim MinRow As Integer
ReDim Array1(0 To 1, 0 To 2)
Array1(0, 0) = 1
Array1(0, 1) = 2
Array1(0, 2) = 3
Array1(1, 0) = 10
Array1(1, 1) = 20
Array1(1, 2) = 30
For X = 0 To UBound(Array1, 1)
Debug.Print Array1(X, 0) & " " & Array1(X, 1) & " " & Array1(X, 2)
Next
MinRow = Application.WorksheetFunction.Min(Array1, 2)
End Sub
Immediate Window:
1 2 3
10 20 30