+ Reply to Thread
Results 1 to 6 of 6

Userform to check Date/Time format correct before copying to worksheet

  1. #1
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Userform to check Date/Time format correct before copying to worksheet

    I've been trying to get my userform to check that the date and time formats are correct before the information is copied to the worksheet. With coworkers not paying attention to how they enter dates and times on the userform, I've been having to go over everything to make sure it is correct. Errors like 13-Feb-1371 and 10:0092 have been popping up every once and again. So far, I've come up with the following coding, except the messagebox always pops up even if it is correct.

    Please Login or Register  to view this content.
    I've tried the following coding instead, but it isn't working for me.

    Please Login or Register  to view this content.
    Last edited by LoneWolf3574; 02-16-2013 at 02:34 AM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Userform to check Date/Time format correct before copying to worksheet

    Hello LoneWolf3574,

    There may be several ways to solve this. To determine which would suit your specific case the best, could you please upload a sample WorkBook, for us to see how best we can help you?
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: Userform to check Date/Time format correct before copying to worksheet

    Trimmed down to attempt to avoid confusion and attached below.

    DateTimeValidation.xlsm

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Userform to check Date/Time format correct before copying to worksheet

    Rather than fight the user, this event will convert from the users date format into yours.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: Userform to check Date/Time format correct before copying to worksheet

    It's not really a matter of format, it's a matter of inattentiveness by the user. The date and time are automatically advance by 2 hour increments and can be changed if needed by the user, sometimes the user tries entering data into either the date or time dropdown lists with out actually looking at the screen and ends up with something like 15-Feb-1359 for a date and 71 for a time. The useform just accepts it as all it is currently looking for is something in the date and time dropdowns. We wish to leave it that way as occasionally there is an issue where data is not collected for a significant portion of a shift due to an emergency or operation requiring the operators attention elsewhere.

    I've tried this with the same level of success as before as well. I know I've got to be missing something simple here.

    Please Login or Register  to view this content.
    Last edited by LoneWolf3574; 02-16-2013 at 04:53 AM.

  6. #6
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: Userform to check Date/Time format correct before copying to worksheet

    OK, I may have found a 'temporary' working solution. It is not exactly what I would like, so I'm still open to ideas. I found something in the combobox properties called "MatchRequired" and changed its setting from False to True. Now a messagebox pops up saying "Invalid Property Value" until the correct value is entered, you can't even close the userform until a correct value is entered. I'd like it to be a little more specific than that, but for the moment, it is a fair 'patch' to my issue.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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