Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Macro to prevent macros from running until certain time

  1. #11
    New Member
    Join Date
    May 2016
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    I am not seeing where...?

    Quote Originally Posted by mikerickson View Post
    I missed a parenthesis

  2. #12
    New Member
    Join Date
    May 2016
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    I found it Long day! Appreciate the help

    Code:
    If (Now() - Int(Now()) < TimeValue("8:30:00")) Then

  3. #13
    New Member
    Join Date
    May 2016
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    How would I work this to be before 8:30 or after lets say 17:00? And after 17:00 to display a different message....

    Quote Originally Posted by 1nk3d View Post
    I am getting "Compile error: syntax error when I use this code, the above one worked fine...
    Last edited by 1nk3d; Feb 14th, 2018 at 08:31 PM. Reason: Forgot to mention different message

  4. #14
    New Member
    Join Date
    May 2016
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    I quoted the wrong message.... Oops
    Last edited by 1nk3d; Feb 14th, 2018 at 08:47 PM.

  5. #15
    MrExcel MVP mikerickson's Avatar
    Join Date
    Jan 2007
    Location
    Davis CA
    Posts
    21,710
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    Put 17:00:00 where my code has 8:30:00.
    One branch of the If will call your code, and you can put a MsgBox in the other.

  6. #16
    New Member
    Join Date
    May 2016
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    Would I place the second if after the else? So Id really like it to be between 8:30 and 5. Anytime before or after should display a message


    Quote Originally Posted by mikerickson View Post
    Put 17:00:00 where my code has 8:30:00.
    One branch of the If will call your code, and you can put a MsgBox in the other.

  7. #17
    New Member
    Join Date
    May 2016
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro to prevent macros from running until certain time

    Ok I got it! I used your code, and added a second line and added ElseIf with the after time.

    Thank you

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •