I have a pretty simple while loop:

VB Code:
  1. While (UBound(LUpper) > 1) And (Cross_product(LUpper(UBound(LUpper) - 2), LUpper(UBound(LUpper) - 1), LUpper(UBound(LUpper))) >= 0)
  2.      Delete_Element LUpper, UBound(LUpper) - 1
  3. Wend

Problem is if a situation arises where Ubound(LUpper) = 1. Rather than moving on as the first paramater of the while loop fails, vb still tries to evaluate the parameters of cross_product function, and in the case of Ubound(LUpper) = 1 the first parameter is subscript out of range.

Is there a way to stop vb evaluating parameters despite the fact their state isn't relevant, or is there another way around forming a while loop to acheive my goal?

Im quite stressed atm so sorry if the solution is obvious, not thinking str8

thanks in advance!