+ Reply to Thread
Results 1 to 4 of 4

DTpicker Date MsgBox

Hybrid View

  1. #1
    Registered User
    Join Date
    03-02-2015
    Location
    Berkshire
    MS-Off Ver
    2013
    Posts
    21

    DTpicker Date MsgBox

    Hi

    I'm very new to this so please bear with me!!

    I have used Date Picker in a User form. I now need to add a message box that pops up if the user selects a date that is today or in the future - All dates must be in the past. Something along the lines of DTPicker1.value >= date()

    Nothing I have tried seems to work! Please could anyone help me right the code for this?

    Thank you!!

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: DTpicker Date MsgBox

    Something like this.....

    Private Sub DTPicker1_Change()
    If DTPicker1 >= Date Then
            MsgBox "You musht pick a date before today's date only.", vbCritical
            Exit Sub
    End If
    End Sub
    
    
    Private Sub UserForm_Initialize()
    DTPicker1.Value = Date - 1
    End Sub
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    03-02-2015
    Location
    Berkshire
    MS-Off Ver
    2013
    Posts
    21

    Re: DTpicker Date MsgBox

    Perfect - thank you!!!

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: DTpicker Date MsgBox

    You're welcome.

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

+ 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. Need DTPicker to export TIME only, not the DATE
    By leopardhawk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2016, 11:34 AM
  2. use DTPicker to select date and populate combobox
    By smartphreak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-02-2011, 03:18 AM
  3. Tabbing to the Date/Time Picker (DTPicker)
    By thornomad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2010, 10:04 AM
  4. Select date value when Dtpicker load
    By nguyennb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2009, 11:51 PM
  5. set date on dtpicker
    By jocke in forum Excel General
    Replies: 0
    Last Post: 11-29-2005, 01:02 PM

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