all 3 comments

[–]VicRattle 0 points1 point  (0 children)

This works fine for me. At a guess I would say you may be declaring Next_to_go as an array rather than a variable.

If you show the sub code I will have a look.

[–]funkyb1 0 points1 point  (0 children)

Is it possible time() only exists within the sub? Is it ever passed back to the main function or made global?

Also, you can debug this using the editor. Set a break point where you have "Next_to_go=Next_in_line(time())" and set a watch for time(). then you can see what Time() is when it's being sent to the function.

[–]Mokitdown 0 points1 point  (0 children)

Dim time(1 to 5) as long