+ Reply to Thread
Results 1 to 5 of 5

VBA code to show to message box between time range

  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Thumbs up VBA code to show to message box between time range

    Dear all,
    This forum has made me to learn lot of new things.Thanks 4 everyone.

    Now, Please give me a VBA a code to POP UP a Msgbox if the user is trying to run the macro between a time range of 2PM to 4.30PM everyday.
    Try to put it in IF statement, if its between the above time range, then it must pop up the msgbox and exit the sub.Else it must run the rest of the code below.

    Thanks for all the support...

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA code to show to message box between time range

    Try this in your macro

    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code to show to message box between time range

    This works...Thanks...

  4. #4
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA code to show to message box between time range

    I know I have marked this thread as solved, but still I raising one more query...What will be the code if want this message box to pop-up on some specific days only.?? Say if date is between 15th to 20th of every month (irrespective of year) and time between 2PM to 4.30PM...
    Plz provide me the code...
    Last edited by mchilapur; 01-15-2015 at 08:31 AM.

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA code to show to message box between time range

    You could try this

    If Time() > 14 / 24 And Time() < 16.5 / 24 And Day(Now()) >=15 And Day(Now()) <= 20 Then

+ 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. Simple code required to show message box on error
    By caabdul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2014, 04:08 PM
  2. [SOLVED] how to add counter in msgbox to show remain times the message will show vba code
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-25-2013, 06:46 AM
  3. how to make only message appear number of time before message does not show
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-06-2013, 07:30 PM
  4. Code needed to repopulate a cell if it's deleted and show a message box.
    By Jed Shields in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-07-2013, 11:59 AM
  5. Modify code to show message box on duplicate entry
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-24-2011, 07:50 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