+ Reply to Thread
Results 1 to 3 of 3

Exit Macro Help (Macro nested vba)

  1. #1
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Exit Macro Help (Macro nested vba)

    So I have about 4 or 5 macros that I call with another Macro.

    The very first Sub has a dialogue box asking for a file, if I click Cancel it will exit the sub but it continues on to the next sub in the list of course.

    I need it to stop processing the original macro. Does that make sense?

    Please Login or Register  to view this content.
    So within the ImportSheet sub, if user clicks cancel it will exit that sub but it goes on to the next macro..which I need to prevent.

    Thanks!

    (I know that I can combine these all into one sub and then the problem would be solved but I have them separate for a reason)

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: Exit Macro Help (Macro nested vba)

    Make the file name a global variable and check for it in subsequent subroutines.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Exit Macro Help (Macro nested vba)

    Quote Originally Posted by dflak View Post
    Make the file name a global variable and check for it in subsequent subroutines.
    That is way over my head, however right after posting I realized I could simply check for a sheet created after the import and if not there exit the sub. It works

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run Excel Macro IF certain condition is met, else exit Macro
    By Martin Chamberlin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-27-2014, 03:13 AM
  2. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  3. Exit Macro
    By Fran Habbitts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2012, 09:36 AM
  4. Run Macro on exit
    By Johnmus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2011, 07:20 PM
  5. Macro does not exit
    By maddog9486 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-06-2010, 01:02 AM
  6. Exit via macro only?
    By Brisbane Rob in forum Excel General
    Replies: 1
    Last Post: 10-13-2005, 09:05 AM
  7. [SOLVED] on exit macro
    By ditchy in forum Excel General
    Replies: 2
    Last Post: 05-02-2005, 08:06 PM

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