+ Reply to Thread
Results 1 to 2 of 2

Confusion regarding EXIT SUB statement within a FOR EACH NEXT loop.

  1. #1
    Registered User
    Join Date
    09-27-2021
    Location
    Washington, DC
    MS-Off Ver
    365 (64 bit)
    Posts
    11

    Question Confusion regarding EXIT SUB statement within a FOR EACH NEXT loop.

    In the following event procedure, upon a ValidateCode = EntryIsValid function procedure (cell) = True condition, wouldn't the Exit Sub statement completely exit the whole procedure, thus the Next cell in loop not being processed? (From book "Power Programming with VBA for Excel 2019; Chapter 6)

    Please Login or Register  to view this content.
    Last edited by hic24; 10-04-2021 at 11:14 PM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Confusion regarding EXIT SUB statement within a FOR EACH NEXT loop.

    Yes, it would.

    I think that's the point, since the code has already tested that that is the InputRange cell although it seems like a very odd way to do it.
    Rory

+ 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] For Loop with If statement and exit sub followed by else
    By nosense in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2015, 04:51 PM
  2. How to exit a function and proceed to the Next statement of a For Loop
    By sugaprasad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-07-2014, 10:41 AM
  3. [SOLVED] How to re-use macro? Best way to loop and "exit" with comparison statement ?
    By varreddor in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-21-2013, 08:43 PM
  4. For Each Statement confusion!
    By joshisms in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 08-31-2013, 02:40 AM
  5. [SOLVED] confusion with IF statement
    By Mortada in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-15-2012, 05:48 PM
  6. IF Statement Confusion
    By penny in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-13-2007, 03:38 PM
  7. If statement confusion
    By DianeR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2007, 07:48 AM

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