Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning from a GoTo 3

Status
Not open for further replies.

TeresePamela

Programmer
Sep 4, 2003
40
US
I want to GoTo a Label and then return to the line below to GoTo - Can I do that in vba? If so, what's the command/syntax. An example:

FIRSTSUB:
Msgbox "Message One"
GoTo SubTwo
MsgBox "Message Two"


SUBTWO:
MsgBox "From Subtwo"


As always, thanks for any input.
Pam
 
You should pull whatever you do in the GOTo out into its own function.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Hi,

You can use GoSub...
Code:
Sub MySub()
...
  GoSub MyLabel
...


  Exit Sub
MyLabel:
...
  Return
End Sub
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks guys - this forum is simply amazing. I'll test this evening.

Thanks again
 
Definately an option to consider TomThumbKP!
Excellent Skip, very helpful!
Have a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top