Return to original Subroutine

jyellis

New Member
Joined
May 3, 2006
Messages
14
I have Sub Click() the calls a Show_form that loads a form;

userform1 loads; then I want that sub userform_activate() to return back to sub Click() and run the sub Copy_All. How do I get it to return to the Sub click() and execute where it left off.

Example:
sub Click()

Show_form

Copy_All

Print_Report

unload userform1

end


Thanks in advance
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

if in your userformcode you have
Me.Hide
or
Unload Me

the code will continue after the line with
UserForm1.Show

example
Code:
Sub Click()
Show_form
Copy_All
Print_Report
Unload UserForm1
End Sub

Sub Show_form()
UserForm1.Show
End Sub

Sub Copy_All()
MsgBox "Copy_All running"
End Sub
userform code
Code:
Private Sub CommandButton1_Click()
Me.Hide
End Sub
kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,113,808
Messages
5,544,408
Members
410,609
Latest member
agarci1096
Top