Results 1 to 3 of 3

Userform date format reverting back to us format on change event

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Userform date format reverting back to us format on change event

    Hi I have created a userform but I am having extensive problems with the date formats.

    My system is set to UK and short date is set to: DD/MM/YYYY

    When I used code to add the values in the userform to the spreadsheet, any that contained a date format would revert to the US format.

    So I finally figured out to use DateValue to format it correctly for example:

    .Cells(lRow, 2).Value = DateValue(Me.yomreferdate.Value)

    This adds the data in the correct format. However when I retrieve the information using a change event for example:

    Me.yomreferdate.Value = ws.Range("yomid").Cells(Me.yomidlup.ListIndex + 1, 1).Offset(0, 1)
    Me.yomreferdate.Value = Format(Me.yomreferdate.Value, "dd/mm/yy")
    ' or -- Me.yomreferdate.Value = DateValue(Me.yomreferdate.Value)
    They return UK formats if the month is less than 12 then revert to US if the date exceeds 12???????

    I have tried alsorts to try and rectify it but I am really struggling can anyone offer me some advice please?

    Thank you in advance.
    Last edited by jpruffle; 08-10-2009 at 12:34 PM.

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