+ Reply to Thread
Results 1 to 4 of 4

End Sub if a Call Function fails

  1. #1
    Registered User
    Join Date
    06-14-2021
    Location
    UK
    MS-Off Ver
    Windows 10
    Posts
    6

    End Sub if a Call Function fails

    I want to End Sub if a Call Function fails.

    I have a button that Calls a Validation Function and then moves to another tab if the validation passes, but if the validation fails I want the Sub to End and not move to the next tab.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,320

    Re: End Sub if a Call Function fails

    Typically, you would define a global Boolean variable. Set it to True or False in the Validation routine, depending on whether or not the validation has passed, the check the variable in the calling routine.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-14-2021
    Location
    UK
    MS-Off Ver
    Windows 10
    Posts
    6

    Re: End Sub if a Call Function fails

    I got it, thanks a lot!!!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,320

    Re: End Sub if a Call Function fails

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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] Function Fails to work
    By Inti in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 06-20-2014, 12:25 AM
  2. =RIGHT Function Fails with Numbers
    By billtreloar in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 11-08-2013, 02:19 PM
  3. DAY-Function fails
    By johntrav2004 in forum Excel General
    Replies: 11
    Last Post: 01-03-2011, 07:19 PM
  4. findnext fails after function call
    By chergh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2008, 03:56 AM
  5. Call to Re-Named Module [to match Sub() name] fails ?
    By CRayF in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-26-2005, 01:05 AM
  6. [SOLVED] Button fails to call macro when open an Excel via Intranet
    By tigertax in forum Excel General
    Replies: 1
    Last Post: 04-12-2005, 06:06 AM
  7. [SOLVED] .ONACTION macro call fails
    By Wayne in forum Excel General
    Replies: 2
    Last Post: 03-02-2005, 02: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