+ Reply to Thread
Results 1 to 4 of 4

Using Now as a StartTime

  1. #1
    Forum Contributor
    Join Date
    03-08-2011
    Location
    London
    MS-Off Ver
    Work Office 365 Home 2019
    Posts
    427

    Using Now as a StartTime

    Hi Folks,

    I have a macro that activates between times.

    The problem I have is that the StartTime has to be in the future. If the StartTime has passed the SchedTimer doesn't run. (See Red Text in Code)

    Has anyone any ideas on how I can fix it so I can run SchedTimer without having to change the StartTime?

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,008

    Re: Using Now as a StartTime

    .
    Maybe (my guess) : Public Const StartTime As Date >= #3:32:00 PM#, EndTime As Date <= #9:30:00 PM#

  3. #3
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: Using Now as a StartTime

    Hi Magicman

    Your macro runs every 3-minutes, i.e. 20 times per hour, starting at 3:32pm.

    Assuming your PC gets turned on late, i.e. after this normal 3:32pm 'StartTime' , then maybe what you are asking for is for your macro to begin at the next 3-minute 'slot'.

    For example, if the PC is switched on at 4:00pm, then maybe you want the macro scheduling to begin at 4:02pm ????

    Maybe something like this..
    Please Login or Register  to view this content.
    ..I haven't tested this

    zeddy

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

    Re: Using Now as a StartTime

    Hi,

    Try adding the code in red below. It's brute force, but the technique is simple and has always worked for me.
    Please Login or Register  to view this content.
    Lewis

+ 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. StartTime for new date at 8PM rather than 12AM
    By samuez in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2014, 10:28 PM
  2. [SOLVED] Create chronological starttime timesheet from a schedule that returns name from same row
    By chris_kanuka in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-05-2014, 03:06 PM
  3. [SOLVED] extract hours that meet conditions from timeframe (starttime and endtime)
    By DirkBekkers in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-27-2013, 09:35 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