+ Reply to Thread
Results 1 to 5 of 5

Macro running other macros does not fully execute

  1. #1
    Registered User
    Join Date
    07-05-2013
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2007
    Posts
    6

    Macro running other macros does not fully execute

    Hello,

    I am attempting to run a macro which executes a couple of different macros in each of a bunch of worksheets in one workbook. It repeats the below for Sheet1, Sheet2, etc.

    Please Login or Register  to view this content.
    Unfortunately, it only seems to run through the first three lines of that code and only for the fist iteration, i.e. on "Sheet1", and then it stops. No error or anything like that.

    I've looked around a bunch, and I've tried line by line execution, removing the SHIFT key from my shortcut command, removing certain sections, and so on. If I remove the first iteration of the code, it will then run through the first three steps on "Sheet2" and then stop. If it's relevant, the sheets are not actually named "Sheet1", "Sheet2", etc., I just edited the code above.

    Any ideas? Thanks for the help!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro running other macros does not fully execute

    One suggestion is there's something within Macro2 halting code execution.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-05-2013
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Macro running other macros does not fully execute

    Great, that makes sense. Thanks for responding!

    EndSub shouldn't do that, should it? The reason I would say that is because both Macro1 and Macro2 end with EndSub, so it doesn't seem like that could be it.

    Let me know if anything here is unclear. The code of Macro2 for your perusal:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro running other macros does not fully execute

    remove the 'End' statement and replace it with 'Exit Sub'

    'End' should never be used by itself
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Registered User
    Join Date
    07-05-2013
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Macro running other macros does not fully execute

    Aha, that makes sense. (Checking...) That's glorious. Thanks so much to both of you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1