+ Reply to Thread
Results 1 to 8 of 8

User Form field inserts wrong date format

  1. #1
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    User Form field inserts wrong date format

    Hello there team.

    I have cobbled together (borrowing from examples I have found online because I don't know VBA) a form which inserts a date into a spreadsheet.

    The trouble I have is that this date field is in USA date format and I need UK.

    If I enter 03/01/2009 into the form, it appears in the spreadsheet as 01/03/2009. I have formatted these cells to display the month only and because of the way it was entered, the next column displays MAR instead of JAN.

    Any ideas?

    Can I validate the input value in a form?


    Thanks for all your help as usual, you guys rule!
    Last edited by simjambra; 03-26-2009 at 08:11 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: User Form field inserts wrong date format

    Hi there,

    Working with dates can often be tricky! The following code (in the VBA code module of the userform) works for me:
    Please Login or Register  to view this content.
    If this doesn't do the trick, post your workbook (or a section of it) here and I'll take a look at it.

    Regards,

    Greg M

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: User Form field inserts wrong date format

    If the date is in format dd/mm/yyyy you can try to use this code (here I suppose your data field in form is called 'Textbox1'):
    Please Login or Register  to view this content.
    Regards,
    Antonio

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: User Form field inserts wrong date format

    The date problem is something users who do not use the American date format have been having to deal with for years


    See my reply in this old thread

    http://www.excelforum.com/excel-prog...and-forms.html

    There is also a little bit more in this thread

    http://www.excelforum.com/excel-prog...-workbook.html
    Last edited by shub; 05-15-2014 at 06:11 AM.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Re: User Form field inserts wrong date format

    Thank you for all your suggestions.

    Here is a copy of the sheet I am using.

    On the Feedback Summary sheet, if you click on the top button, a form appears. The feedback is recorded and then summarised on the other sheet.

    The trouble is, I am now trying to work out how to summarise each category for each trainer PER MONTH so when the date goes in, incorrectly it's not gerating the correct date.

    Mudraker, I couldn't see those hyperlinks but I will have a search.

    Thanks
    Attached Files Attached Files

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: User Form field inserts wrong date format

    Hi again,

    The highlighted addition to your code seems to give the correct result on my system (Excel 2000):

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  7. #7
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Re: User Form field inserts wrong date format

    Greg, that seems to work great.

    Cheers mate

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: User Form field inserts wrong date format

    Hi again,

    Many thanks for your feedback - I'm very pleased that I was able to help.

    Regards,

    Greg M

+ 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