+ Reply to Thread
Results 1 to 7 of 7

Loop is stopping half way

  1. #1
    Registered User
    Join Date
    04-30-2020
    Location
    Boston
    MS-Off Ver
    365
    Posts
    20

    Loop is stopping half way

    Hi,

    I have the following code that loops through a Column that contains "Failed" and "Passed" in a workbook. I just realized that in the workbook there are 10 items that have "Failed" and its only copying like 5 of them. for me to get all ten items copied over I have to run it twice and that's a pain when I have a lot of values.




    Please Login or Register  to view this content.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Loop is stopping half way

    Could you attach a desensitized version of the file so we can see it in context?

    BSB

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,070

    Re: Loop is stopping half way

    Make sure that the cells say Failed, rather than failed or FAILED as VBA is case sensitive.
    Also check for any leading/trailing spaces.

  4. #4
    Registered User
    Join Date
    04-30-2020
    Location
    Boston
    MS-Off Ver
    365
    Posts
    20

    Re: Loop is stopping half way

    Here's how the Workbook looks like

    Attachment 710571


    Everything is fine it's just not picking up all the data. If you need anything else let me know

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Loop is stopping half way

    That attachment doesn't work for me. Follow the instructions in the yellow bar at the top of the forum for details on how to attach a file.

    BSB

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Loop is stopping half way

    Your Code is full of Errors

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

    If you have a lot of data then this solution will be a lot faster:

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 12-27-2020 at 06:59 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  7. #7
    Registered User
    Join Date
    04-30-2020
    Location
    Boston
    MS-Off Ver
    365
    Posts
    20

    Re: Loop is stopping half way

    You're right mehmetcik there are some errors I didn't realize that. I made a small code of the actual code.

    Please Login or Register  to view this content.
    So the code above is a more accurate.
    Last edited by pedro53; 12-27-2020 at 10:34 PM.

+ 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. Stopping a loop when you get a match
    By locopete999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2018, 05:30 AM
  2. [SOLVED] Loop Not Stopping
    By Dummy99 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2016, 03:58 PM
  3. Stopping a Do Loop at blank cell
    By Austex_egger in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-27-2013, 06:25 PM
  4. [SOLVED] Loop not stopping at end of sheet
    By DanzaNZ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2013, 06:33 PM
  5. [SOLVED] Stopping loop in Range if there is no value in row
    By EM1987 in forum Excel Programming / VBA / Macros
    Replies: 41
    Last Post: 10-11-2013, 12:36 PM
  6. Copy and Paste Loop but keeps stopping
    By kksf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2013, 04:03 AM
  7. Loop is stopping for no apparent reason.
    By Melissa9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2012, 03:08 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