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
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

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
 

Forum statistics

Threads
1,141,011
Messages
5,703,722
Members
421,311
Latest member
tanujath

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top