+ Reply to Thread
Results 1 to 3 of 3

Stop continuous loop with no errors

  1. #1
    Registered User
    Join Date
    09-06-2017
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    1

    Stop continuous loop with no errors

    Hello, I have an Excel file with 4 worksheets that will be projected onto TV screens in my warehouse. I have a macro that will continuously rotate through the spreadsheets and show each of them for 15 seconds before moving to the next sheet. And then once it hits the last sheet and displays it for 15 seconds, it will go back to the 1st sheet and start over (i.e. a continuous loop). This is the code I have so far:

    Please Login or Register  to view this content.
    I'd like to have 2 different ways of stopping the loop: 1) after a set amount of time, ex. after 5 minutes, and 2) after a key is pressed in case I need to stop it before the 5 minutes are up. If I stop it by pressing a key, I need it to stop the macro "silently" and not have any error message since it will be projected onto a TV screen for others to view. When I hit ctrl+break or ESC, the macro stops but a "Code execution has been interrupted" message pops up.

    I would really appreciate any help!

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Stop continuous loop with no errors

    If you have an available field, you could have a separate routine load it with STOP or Null.

    Please Login or Register  to view this content.
    Just a thought
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

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

    Re: Stop continuous loop with no errors

    I think that you should consider using the ontime function.

    This will enable you macro to pause between changing sheets.

    You can then use a Right Click to set a flag that will stop your macro.

    ontime can also stop your macro after 5 minutes

    I would have used something like this:-

    Please Login or Register  to view this content.


    And this as a workbook Macro

    Please Login or Register  to view this content.

    However I cannot get it to work properly
    Last edited by mehmetcik; 09-06-2017 at 07:01 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.

+ 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. Which is faster: Errors or IF statements to stop Errors?
    By carsto in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-30-2016, 10:07 AM
  2. How to loop through all the records on a continuous form.
    By PSSMargaret in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2016, 08:31 PM
  3. [SOLVED] MIN function, ignore blanks and errors, not a continuous range...
    By spacely in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-16-2016, 08:59 PM
  4. Sum IF ... Continuous Loop
    By obwales in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2015, 05:35 PM
  5. Stop a continuous macro
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-10-2015, 09:42 AM
  6. Need to run continuous loop
    By hockeyadc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2012, 02:03 PM
  7. Continuous loop using a UserForm
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2011, 08:10 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