+ Reply to Thread
Results 1 to 9 of 9

Date is not inserted properly in Textbox (UserForm)

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Date is not inserted properly in Textbox (UserForm)

    Good day
    I am trying to populate a UserForm with the right date format and I guess my method is not doing this properly.

    I have a UserForm with the following code:

    Please Login or Register  to view this content.
    My d is a module

    Please Login or Register  to view this content.
    I have another Userform set as a calendar2 that if the user presses down on the textbox that it will call the Calendar2 and the user will be able to select the date required.

    I have tried changing the .text to value but nothing, the date always adds itself has 2014/06/30 in both textboxes.

    What am I doing wrong? maybe my change_event but this should not be triggered at the UserForm_Initialize right?
    Click the star icon in the lower left part of the contributor's post and add Reputation if we have helped you .

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date is not inserted properly in Textbox (UserForm)

    What isnt' being populated properly?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Date is not inserted properly in Textbox (UserForm)

    My Textboxex (TextBox4 and TextBox5)

    Problem seem to be here:
    Please Login or Register  to view this content.
    Everytime I populate my Userform and, let's say my date in my Range("Q" & ActiveCell.row) = to 2014/07/07, it will populate in my UserForm as 2014/06/30.
    Last edited by Excelnoub; 06-30-2014 at 10:37 AM.

  4. #4
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Date is not inserted properly in Textbox (UserForm)

    Here is a workbook,

    If you D_Click on the W8486-123456 you will see that the date is not even the same as the information on sheet

    VBE - UserForm (frmamendment)

    Date.xlsm

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date is not inserted properly in Textbox (UserForm)

    Remove this code.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Date is not inserted properly in Textbox (UserForm)

    Bingo, Thank you Norie

  7. #7
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Date is not inserted properly in Textbox (UserForm)

    Yes but the problem with this is that if the user inserts a new date the format will not be my yyyy/mm/dd but will reset to it's original format: mm/dd/yyyy.

    That is why I had the Change_Event for the textbox format to be yyyy/mm/dd.

    Is there a way to make it that all my textboxes date value = yyyy/mm/dd?

    frmCalendar2 =


    Please Login or Register  to view this content.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date is not inserted properly in Textbox (UserForm)

    Don't use the Change event, use another event eg AfterUpdate, Exit.

  9. #9
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Date is not inserted properly in Textbox (UserForm)

    This will work too

    Once again thank you Norie

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Userform Textbox Date Format
    By saban1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2014, 10:52 AM
  2. [SOLVED] Excel 2007, Userform Textbox Date Format and Calendar Control Userform
    By riffology in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2014, 06:18 PM
  3. Date Format for textbox in userform
    By processchip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2011, 06:42 AM
  4. Entering a date into a userform textbox
    By jerseyguy1996 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2010, 12:28 PM
  5. Rows inserted into a List will not sort properly
    By Derek Jones in forum Excel General
    Replies: 2
    Last Post: 11-08-2005, 11:10 AM

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