Hi I am trying to create a program in VBA where I have an Array A and I am trying to Iteratevely find the minimum value in the array, get its position in the array and next update its value to an arbitrary large number (say 9999).
The code I have come up with so far is something like this
MinValue = Application.WorksheetFunction.Min(A)
ArrayPos = Application.WorksheetFunction.Match(MinValue, A, 0)
A(ArrayPos) = 9999
However the Variable ArrayPos which is the index of the position in the array never seems to get updated after the first iteration.
Does any body have any ideas what can be the problem?
Thanks in advance
The code I have come up with so far is something like this
For j = 0 To Len(A)
MinValue = Application.WorksheetFunction.Min(A)
ArrayPos = Application.WorksheetFunction.Match(MinValue, A, 0)
A(ArrayPos) = 9999
Next j
However the Variable ArrayPos which is the index of the position in the array never seems to get updated after the first iteration.
Does any body have any ideas what can be the problem?
Thanks in advance