1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel/VBA - Have a module call another

Discussion in 'Business Applications' started by AMorrison0903, May 6, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. AMorrison0903

    AMorrison0903 Thread Starter

    Joined:
    Apr 11, 2008
    Messages:
    79
    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.
     
  2. Jimmy the Hand

    Jimmy the Hand

    Joined:
    Jul 28, 2006
    Messages:
    1,220
    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
     
  3. Zack Barresse

    Zack Barresse

    Joined:
    Jul 25, 2004
    Messages:
    5,447
    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
As Seen On...

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.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/710139