+ Reply to Thread
Results 1 to 6 of 6

Stop macro after specifc time comes

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Stop macro after specifc time comes

    Hi.

    How stop macro after specifc time comes?

    Please Login or Register  to view this content.
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Stop macro after specifc time comes

    Hi marreco,

    I had success with the following.

    ThisWorkBook Module:
    Please Login or Register  to view this content.

    Ordinary Code Module (such as Module1):
    Please Login or Register  to view this content.
    Lewis
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Stop macro after specifc time comes

    Hi LJMetzger work nice, thank you!!

    I'll do some tests, but i want say thank you very much!!

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Stop macro after specifc time comes

    Hi

    Based your attachment, i need change trigger to run macro "Main_Macro"

    The "Main_Macro" only run after cells change, but i need automatically stop this "Main_Macro" when #9:27:00 AM# comes?

    How i automatically stop this macro?

    Please Login or Register  to view this content.
    Thank you!!!

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Stop macro after specifc time comes

    You need a software flag to tell Main_Macro that the time has expired. See the attached sample worksheet and the code that follows. Important changes are in red. In the Main_Macro() routine, you can add or delete checks that 09:27 has arrived as required.

    Please note that Main_Macro() will NEVER run when the value of bScheduledTimeCompleted is 'True'. If you want to run Main_Macro() without the timer running, you have set the value to 'False' before running Main_Macro().

    Lewis

    ThisWorkbook module (no changes):
    Please Login or Register  to view this content.
    Sheet1 Module (all new - important items in red):
    Please Login or Register  to view this content.

    Ordinary Code Module:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Stop macro after specifc time comes

    Hi LJMetzger

    I like their solution, their knowledge is generally fantastic !!

    can't click twice in star, but i try another way..

    very thank you !!!!!!!!!!

+ 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. Can not run the macro - Start Stop Time button
    By tangerine7199 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-22-2014, 02:41 PM
  2. Replies: 3
    Last Post: 12-18-2012, 07:19 PM
  3. Replies: 0
    Last Post: 11-19-2012, 03:55 AM
  4. Replies: 1
    Last Post: 02-23-2012, 09:01 AM
  5. Stop running a macro at a certain time
    By trey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2009, 09:45 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