Right, but there is still the problem that the array isnt defined until the end of the loop and that the sub routine has to be called within the loop. I need the max value of the final completed array, and returned into the loop..:-\.. when i wrote a subroutine it kept running it before it was called within the loop, and i would never get the final max value until the very end of the loop, by which point it was too late.
thanks