Results 1 to 3 of 3

Thread: Solved: Understanding Modules

  1. #1
    VBAX Regular rrtts's Avatar
    Joined
    Sep 2006
    Posts
    61
    Location

    Solved: Understanding Modules

    Is there any advantage or disadvantage to having multiple modules or can I throw the VBA code for multiple subroutines into one module and record a macro as necessary from the code within the module.

    (Hope that makes sense)

    Also, I have two macros (using a button to activate each of them) that work perfectly but I'm having a hard time getting one button to operate both. Am I missing something?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Have multiple modules. There are two major advantages, it allows you to organise your code more logically, and it avoids running up against the 64Kb module size limit.

    Call one from within the other

    [vba]

    Sub Macro1() 'assign this to the button
    ... some code
    call Macro2
    End Sub

    Sub Macro2()
    ... some more code
    End Sub
    [/vba]

  3. #3
    VBAX Regular rrtts's Avatar
    Joined
    Sep 2006
    Posts
    61
    Location
    ah...placement is everything...finally tinkered around with it long enough and got it to work.

    And thanks for the info on modules...appreciate the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •