+ Reply to Thread
Results 1 to 2 of 2

exit main macro from sub macro

  1. #1
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    exit main macro from sub macro

    Hello Gurus,

    I have a macro that runs several other macros via call statements. If there is an error in one of the sub macros, is it possible to exit the main macro from a sub macro? This would allow the user to fix the error.

    If so, what would that code look like?

    TIA, Tim

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: exit main macro from sub macro

    Redefine your procedures as Functions, add error handling and handle any errors. The main procedure then turns into a series of IFs ...
    Please Login or Register  to view this content.
    Just one of many different strategies to deal with this scenario but whatever you do you are going to be dealing with Error handlers

+ 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. [SOLVED] Macro to Exit Sub if d21 and D41 are both zero
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2020, 11:24 PM
  2. [SOLVED] Returning to Main Macro from a Called Procedure after a MsgBox/Exit Sub
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-18-2018, 09:15 AM
  3. [SOLVED] Exit Macro Help (Macro nested vba)
    By NewYears1978 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2017, 03:06 PM
  4. Sub Macro not working with main Macro
    By sachin483 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2016, 02:59 AM
  5. 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
  6. Exit Macro
    By Fran Habbitts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2012, 09:36 AM
  7. to exit main procedure from procedure called by yhe main
    By kmlprtsngh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2010, 02:46 PM

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