VBA array - find largest element

  • Thread starter Thread starter R. Choate
  • Start date Start date
That was much better. Thanks for the tip and the code.

Are you saying though, that using a UDF like the one you gave me will run faster than calling a worksheet function in VBA like the
max function? I was always under the understanding that UDFs are the 2nd slowest thing you can use, right behind array formulas on a
spreadsheet (Boy, those are slow. I love the way they work but I hate the performance and the sensitivity of them; always having to
use the ctrl+shift+enter when you write them or edit them. The only thing you can do normally is copy them.).

--
RMC,CPA


lol, sorry for my silly mistake. I wrote the code straight away from my
mind without checking it. It is supposed to be a FUNCTION that returns
value instead of procedure.

Please replace Sub with Function at the first and last statement

Function ....
.....
End Function


If your array declaration is like this:
Dim prog(5) As Integer

Then the statement below should work:
Msgbox getMax(prog)


It should work (I have tested it).

Sorry again,
 
Back
Top