Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Excel/VBA - Have a module call another


(!)

AMorrison0903's Avatar
AMorrison0903 AMorrison0903 is offline
Member with 79 posts.
THREAD STARTER
 
Join Date: Apr 2008
Experience: MCSE
06-May-2008, 09:17 AM #1
Excel/VBA - Have a module call another
Is it possible in excel to have a module automatically run another module after the execution of the first module is complete?

if so, how?

thanks.
Jimmy the Hand's Avatar
Member with 1,220 posts.
 
Join Date: Jul 2006
Location: Hungary
Experience: Level 15 Paladin
06-May-2008, 09:45 AM #2
As far as I know, you don't run modules in Excel. You run macros (or subroutines) that are placed on modules. You can run the macros in any order and you can call them from each other. E.g.

Code:
Sub Macro1
    'code
    'code
    'code
    Macro2   'Calling Macro2
End Sub

Sub Macro2
    'code
    'code
    'code
End Sub
In the above example, Macro1 calls Macro2 at the end of its own run. Theoretically, this calling hapens before Macro1 is finished but, prctically, there's not much difference.

Is this what you need, or have I got it wrong.

Jimmy
Zack Barresse's Avatar
Computer Specs
Member with 5,434 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
06-May-2008, 04:56 PM #3
It would probably be less confusing to call them both from another routine...

Code:
Sub CallBoth()
    Call Macro1
    Call Macro2
End Sub

Sub Macro1()
    'code
End Sub

Sub Macro2()
    'code
End Sub
HTH
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
Solved: Word and Excel 2007 compile error in hidden module kabal02 Business Applications 3 08-Jul-2008 06:34 PM
run more than one module - excel/vba AMorrison0903 Business Applications 0 05-May-2008 01:51 PM
excel 2007 DDE call toledo1 Business Applications 1 30-Nov-2007 03:02 AM
Solved: Excel module to .exe youwillbowdown Business Applications 10 08-Nov-2007 06:08 PM
Excel: Compile Error in Hidden Module sdblouch Business Applications 3 15-Jun-2007 05:49 PM

WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑