+ Reply to Thread
Results 1 to 8 of 8

Running a macro on specific day and time

  1. #1
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Running a macro on specific day and time

    Hi all

    I have written the following macros with help from the internet.

    I am trying to get an already open Excel workbook to execute a macro every monday at 6:00:00 am.

    But i get an error when the time is reached saying the macro "RunWhen" is not available in the worksheet.

    Please Login or Register  to view this content.
    Can anyone help me please

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Running a macro on specific day and time

    This works for me. Put the code in a standard module, not a sheet module. For testing today, I've used vbWednesday instead of vbMonday, and a time in the near future.
    Please Login or Register  to view this content.
    Last edited by Chippy; 12-19-2012 at 11:46 AM.
    Post responsibly. Search for excelforum.com

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

    Re: Running a macro on specific day and time

    Chippy! Great code! I have not done this stuff so far.

    Please Login or Register  to view this content.
    Am I right this code means, if the date set = today's date, excute Sheets("Sheet1").Range("A1") = 1 code? If I am right, this means I can call any macro once If Weekday(Date) = vbWednesday Then is set? Am I right?

  4. #4
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Running a macro on specific day and time

    AB33, correct. But please start your own thread with your specific request if you have further questions about this.

  5. #5
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Running a macro on specific day and time

    Hi Chippy

    Thanks for the help, the code seems to be working if I activate it on the specified time, but it soes not activate by itself.

    Any sugestions?

    Please Login or Register  to view this content.
    Last edited by Freakazoid; 01-16-2013 at 03:14 AM.

  6. #6
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Running a macro on specific day and time

    Is there nobody that has a solution to my problem?

    How to activate a macro, every monday at 6:00 am

    Please Login or Register  to view this content.
    Last edited by Freakazoid; 01-16-2013 at 03:28 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Running a macro on specific day and time

    Quote Originally Posted by Freakazoid View Post
    Thanks for the help, the code seems to be working if I activate it on the specified time, but it does not activate by itself.
    Call AutoUpdateWhen from the Workbook_Open routine. Save, close and reopen the workbook any time before 6 am on a Monday and leave an Excel instance open or the workbook itself open for AutoUpdateOn to run at 6 am on Monday and again the next Monday a week later (it actually runs every day at 6 am but just reschedules itself if it isn't Monday). If you don't want to keep Excel/the workbook open like this have a look at using the Windows Task Scheduler to open and run the macro every Monday at 6 am.

  8. #8
    Registered User
    Join Date
    10-21-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Running a macro on specific day and time

    Thanks alot Chippy that was the last thing I needed to get it all working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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