+ Reply to Thread
Results 1 to 6 of 6

Copying date values from Userform to Spreadsheet keeping same format

Hybrid View

mhuddles1981 Copying date values from... 08-10-2010, 11:15 PM
snb Re: Coping date values from... 08-11-2010, 06:38 AM
royUK Re: Coping date values from... 08-11-2010, 06:49 AM
mhuddles1981 Re: Coping date values from... 08-11-2010, 05:04 PM
romperstomper Re: Copying date values from... 08-12-2010, 01:50 AM
royUK Re: Copying date values from... 08-12-2010, 01:53 AM
  1. #1
    Registered User
    Join Date
    05-07-2010
    Location
    Queensland, Australia
    MS-Off Ver
    Excel 2003
    Posts
    29

    Copying date values from Userform to Spreadsheet keeping same format

    Hi All,
    I am having a bit of a problem with copying a date entered into a userform into a spreadsheet keeping the right format.
    Say if I enter the value dd/mm/yyyy in the user form when it copies to the spreadsheet it displays this as mm/dd/yyyy.
    here is an the part of my coping sub:

    Range("E" & lastrow).Value = Format(Me.L_DO.Value, "DD/MM/YYYY")
    I even have in the initialise sub:
    Me.L_DO = Format(Date, "DD/MM/YYYY")
    But still can't get it to copy over properly.

    Any help is greatly appreciated

    Cheers
    Last edited by mhuddles1981; 08-13-2010 at 01:48 AM. Reason: Solved

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Coping date values from Userform to Spreadsheet keeping same format

       Cells(1, 1) = Format(Me.L_DO.Value, "mm/dd/yyyy")

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Coping date values from Userform to Spreadsheet keeping same format

    There's some example that would be better than textbox here

    The combobox example is the one that i use regularly
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    05-07-2010
    Location
    Queensland, Australia
    MS-Off Ver
    Excel 2003
    Posts
    29

    Smile Re: Coping date values from Userform to Spreadsheet keeping same format

    Hi RoyUK and snb,

    Thankyou both for your responses.

    snb, are you saying that I need to reverse the format of the value? the format that I want to happen is DD/MM/YYYY but it comes up with MM/DD/YYYY.


    Roy, the exmaple for the date picker is great but how would you incorporate this into a Userform?

    Thanks for the advise so far, any further advise is greatly appreciated.

    Regards

    Michael

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Copying date values from Userform to Spreadsheet keeping same format

    You can use Cdate (make sure the target cell is formatted as you want):
    Range("E" & lastrow).Value = CDate(Me.L_DO.Value)
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Copying date values from Userform to Spreadsheet keeping same format

    The combobox example is the easiest to incorporate

+ 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