Calling a sub or function

J

Junior

I have a sub Sub2 that is now behind the click event on a form's command
button. cmd2
I want to run sub2 from a line in Sub1 - sub1 is activated by a click event
on cmd1.
i.e. i would like to run all of the code by pressing cmd1
i know i can insert the sub2 code into sub1- but it is long- and i'd like to
learn how to call a sub or function from another sub.
So can someone give me some tips-help
 
M

Marshall Barton

Junior said:
I have a sub Sub2 that is now behind the click event on a form's command
button. cmd2
I want to run sub2 from a line in Sub1 - sub1 is activated by a click event
on cmd1.
i.e. i would like to run all of the code by pressing cmd1
i know i can insert the sub2 code into sub1- but it is long- and i'd like to
learn how to call a sub or function from another sub.


Just call sub2 from the code in sub1.

Sub2 arglist
or
Call Sub2(arglist)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top