+ Reply to Thread
Results 1 to 8 of 8

Date Format -USA to UK in Userform

Hybrid View

Badvgood Date Format -USA to UK in... 02-12-2010, 11:38 AM
Andy Pope Re: Date Format -USA to UK in... 02-12-2010, 11:52 AM
Badvgood Re: Date Format -USA to UK in... 02-15-2010, 07:15 AM
Andy Pope Re: Date Format -USA to UK in... 02-15-2010, 07:23 AM
Badvgood Re: Date Format -USA to UK in... 02-15-2010, 07:24 AM
Andy Pope Re: Date Format -USA to UK in... 02-15-2010, 07:27 AM
rwgrietveld Re: Date Format -USA to UK in... 02-15-2010, 07:54 AM
Badvgood Re: Date Format -USA to UK in... 02-15-2010, 08:53 AM
  1. #1
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304

    Date Format -USA to UK in Userform

    Is there anyway of getting a userform to send the date out in UK format rather than American?

    I have read many posts on it this afternoon and cant get any to work for my user form.

    The database which the user form sends to cannot be changed.

    Regards BVG
    Last edited by Badvgood; 02-15-2010 at 08:54 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Date Format -USA to UK in Userform

    Hard to say as you do not provide much info.

    But have you tried formatting the value, something like,

    Format(Date,"dd/mm/yyyy")
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304

    Re: Date Format -USA to UK in Userform

    Hi,

    The spread sheet is now attahced.

    The form is CmdLoadNewVehicle and the field that is giving me the problem is the Date Into Stock feild.

    I want this to accept UK date format dd/mm/yy and when it send its value to the Vehicle List Sheet, column C for it to stay in UK date format.

    Any ideas?
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Date Format -USA to UK in Userform

    Try,

    ws.Cells(iRow, 3).Value = DateValue(Me.txtDateIntoStock.Value)

  5. #5
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304

    Re: Date Format -USA to UK in Userform

    Thanks for that but as a complete novice at VBA, where do I put that code?

    Thanks BVG

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Date Format -USA to UK in Userform

    It replaces the existing code you have in the cmdAdd click event.

    It does require the date to be entered in uk format.

    You would avoid a lot of confusion if you used dd/mmm/yyyy on the userform.

  7. #7
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Date Format -USA to UK in Userform

    It does require the date to be entered in uk format.
    I must add to this that it bwill take any format specified by your regional setting (Windows settings)

    Even "2012, Dec, 31" will be OK.

    If you would like to force dd/mm/yy you'll have to make a full routine to check. You can make a suggestion (for the users) by adding this:

    Private Sub UserForm_Initialize()
      Me.txtDateIntoStock.Text = Format(Now, "dd/mm/yy")
    End Sub
    Datevalue itself will transform the STRING into a Excel date type (number of days starting from 00/01/1900)
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  8. #8
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304

    Re: Date Format -USA to UK in Userform

    thank you both for your help, now fixed.

+ 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