Hello again,
Another puzzler for you.
We have some Subs that are designed to work in a specific way and utilise GoTo points in order for them to be multifunctional, compact and clever. However, we are now realising that it would be a massive advantage if we could use these GoTo points as entry points from other subroutines.
For example...
Currently, When this is run, you get message boxes 1 to 5 in order. That's fine. But what if I wanted only to run the code in that sub for stage 3?Sub One() 1: MsgBox ("1") GoTo 5 2: MsgBox ("3") GoTo 4 3: MsgBox ("5") Exit Sub 4: MsgBox ("4") GoTo 3 5: MsgBox ("2") GoTo 2 End Sub Sub Two() Call One End Sub
Is there a way to say, 'Call One and then go immediately to 3 as your entry point.'?
The only way we could currently think of doing it would be to pass a public variable to from sub Two to sub One saying 'If the variable is X then GoTo 3 else do nothing.' But this seems like a messy and unpleasant way of doing things.
Thanks in advance,
Rob.