+ Reply to Thread
Results 1 to 6 of 6

Loop stuck in exit sub

  1. #1
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Loop stuck in exit sub

    Hello friends, Hope all is well!

    I am having difficulty with looped code here.

    I want the loop to run on range R10 and so on.
    if the cells = "", then exit sub if cell does not "" then proceed,
    The problem I am having is that the code is not moving to the next cell

    please help me, and thanks a lot in advance!


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by countryfan_nt; 03-12-2017 at 07:30 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Loop stuck in exit sub

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Loop stuck in exit sub

    You might have a gap in your data and the loop probably will not move down.

    Change this line

    NumRows = Sheets("pt").Range("bR10", Range("bR10").End(xlDown)).Rows.Count

    INTO

    NumRows = Sheets("pt").Range("bR10", Range("bR10").End(xlUp)).Rows.Count

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

    Re: Loop stuck in exit sub

    And you might just be exiting the procedure as soon as a blank cell is found... You need to check the logic around the lines

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Re: Loop stuck in exit sub

    after wrestling with code, I think I got it! any suggestions, or comments?
    is this an efficient way? thanks!

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Loop stuck in exit sub

    If your intention is to copy the range, you do not need to loop over the rows, but I do not know what is the call function is doing and so this code ignores the call function.

    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. [SOLVED] Stuck in For Each Loop
    By Bob1980 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2012, 06:08 PM
  2. [SOLVED] Do - Loop Until loop with randbetween gets stuck
    By supern0va in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-31-2012, 06:06 AM
  3. Stuck on a Loop
    By adamcross in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-02-2012, 07:50 AM
  4. Stuck in a loop
    By dem86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2011, 01:20 PM
  5. Stuck in a loop
    By cdmg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2010, 03:19 AM
  6. stuck in a Do Loop?
    By keatonlg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2009, 12:35 AM
  7. [SOLVED] Stuck in a loop
    By CWillis in forum Excel General
    Replies: 2
    Last Post: 06-05-2006, 09:55 AM
  8. HELP - Stuck in loop
    By gti_jobert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2006, 08:41 AM

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