+ Reply to Thread
Results 1 to 5 of 5

How to stop looping in windows 7

  1. #1
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    How to stop looping in windows 7

    Hello Friends,

    i am making a loop around 50000 to extract the data

    if suppose i want to stop the loop (to check the loop counter) in between process then how to do it.
    because in XP, if i press escape button then loop stop and i can check how much data extract till then again i press F5 to start

    but in windows 7 if i press escape button while in loop the it says not responding and i have to close this window from task manager.

    Please suggest
    if i want to check how much counter goes in loop then how to check?
    Last edited by mohan.r1980; 06-18-2016 at 01:40 AM.

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

    Re: How to stop looping in windows 7

    I suspect you falling in to infinite loop. This could only happen if you are using a while loop. For a loop always end when the loop ends. You can also stop For loop before the end of the loop. Let's say you have.
    Option Explicit

    Please Login or Register  to view this content.
    This code loops from row 2 until the end of none empty data in column A.
    You can also use this line.
    For i = 2 To 500
    The code can either go all the way to 500, but can also terminates when it reaches 100 if you include if statement.
    If i = 100 Then Exit For
    Last edited by AB33; 06-17-2016 at 06:33 AM.

  3. #3
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: How to stop looping in windows 7

    dear sir,
    thanks for reply
    i am troubling in loop when suppose i want to manualy stop the running code to check how much counter show.
    e.g.
    Please Login or Register  to view this content.
    in above case i want check the "J" value when i press escape button, that mean code or loop stop where it is and i can check the "j" counter value.
    this happen in XP but not in windows 7
    Please suggest

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

    Re: How to stop looping in windows 7

    This is nothing to do with windows versions. You are running a code in excel, you have a control of it. The reason for pressing ESC or break is you want to stop the code from running mainly because it is not responding or taking long time to finish.
    On the below code, I am telling the loop to show me in message box when it reaches loop 10. I am controlling it. You can also do what ever you like, it is your loop.
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: How to stop looping in windows 7

    thanks sir
    i will do it

+ 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. How to stop looping if cell A is empty
    By ahmeonline in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2015, 09:16 AM
  2. [SOLVED] NON-VBA: FORMULA NEEDED - Looping through string and stop on non-numeric
    By dluhut in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-09-2014, 12:37 PM
  3. Stop looping at a specific sheet
    By Bpd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2013, 11:03 PM
  4. [SOLVED] Stop looping
    By cdafonseca in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2013, 11:13 PM
  5. [SOLVED] Stop Message Box looping when OK is selected
    By connieb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 04:40 PM
  6. How to stop Macro from looping
    By cooh23 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2007, 01:05 PM
  7. [SOLVED] Do Loop Won't Stop Looping
    By Lost in Alabama in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-22-2006, 08:30 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