Consulting

Results 1 to 3 of 3

Thread: Macro to do one thing before 16:00 Hrs & something else after 16:00 hrs

  1. #1
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location

    Macro to do one thing before 16:00 Hrs & something else after 16:00 hrs

    I need to set up a spreadsheet with an button to create and send an email automatically which i can do but i also need it to do one thing before 16:00 hrs (today) and another 16:00 to 23:59. e.g. they press the button at 15:00 and a message box would display "Before 16:00 hrs): If they press it at 16:01 the message box would say "After 16:00 hrs). I've not really used time before and have no clue how to start.Thank you

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    try:
    If Time > 16 / 24 Then MsgBox "after" Else MsgBox "before"
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location
    Thank you so much. I would have spent ages trying to figure this out but can now adapt what you gave me in no time at all. Really appreciated and thanks again

Tags for this Thread

Posting Permissions

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