+ Reply to Thread
Results 1 to 8 of 8

Excel glitch? (Userform Textbox = Format, "Date")

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

    Excel glitch? (Userform Textbox = Format, "Date")

    Good day,
    I just want to point out a small glitch or am I doing something wrong?
    I have the following code that makes my Textbox3 from my Userform add the date format to “YYYY-MM-DD”

    I came across yesterday a weird date glitch... When I selected 2013-11-12 it gave me 2013-12-11 but this means December 11, 2013 I want November 12, 2013. Today it works perfect and it writes down the code in accordance to the code, but still doesn’t take the November 12, 2013... Why?
    Userform Code:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Note: Plus my Column is set to Custom "YYYY-MM-DD"

  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: Excel glitch? (Userform Textbox = Format, "Date")

    How exactly are you putting the date in the textbox?
    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: Excel glitch? (Userform Textbox = Format, "Date")

    Because I have multiple date entries within the same userform, I have multiple calendars set up (total 3), the reason why 3, is that I am able to control multiple date entries to specific textbox without adding dates to multiple textbox... each textboxs is triggered by it's own calendar.

    So for this textbox3 I have frmCalendar2.Show that pop-up and I can select my date from this calendar form and on selection it transfers the info to my textbox3.

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

    Re: Excel glitch? (Userform Textbox = Format, "Date")

    How is the date transferred to the textbox?

    Have you considered losing the change event and directly putting the formatted date into the textbox from the calendar?

    By the way, you could easily handle multiple date entries using a single calendar form.

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

    Re: Excel glitch? (Userform Textbox = Format, "Date")

    For the calendar I had some trouble adding multiple entries to different textboxs. If I had for example Textbox3 and textbox4 with date entries... I would add the code:

    Please Login or Register  to view this content.
    But it would add the date in both textbox, I know i'm missing something to use only one calendar but that would be another thread

    _______________________

    I have the following calendar2:

    Please Login or Register  to view this content.
    Then in my userform I have the following code (not all code but only for Textbox3)

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    Problem is that if November 12, 2013 is selected it shows as 2013-12-11 but the code sais that the format is YYYY-MM-DD... I need it to show as November 12, 2013 and not December 11, 2013...

    But November 13, 2013 works perfect... I am so confused

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

    Re: Excel glitch? (Userform Textbox = Format, "Date")

    So, why not try what I suggested?

    Instead of using the textbox's change event to format the date use the code in the calendar form to put the already formatted date in the textbox.
    Please Login or Register  to view this content.

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

    Re: Excel glitch? (Userform Textbox = Format, "Date")

    Here Is a test you just have to select New Entry (Command Button).

    Datetest.xlsm

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

    Re: Excel glitch? (Userform Textbox = Format, "Date")

    Got it I have changed

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    this fixes it :D

    Thank you Norie :D

+ 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. VBA change pivot "report filter" from userform textbox or combobox
    By mmor79 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2014, 12:57 PM
  2. [SOLVED] UserForm - TextBox = Format("yyyy/mm/dd")
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2013, 12:16 PM
  3. Date format of just "st" "nd" "rd" and "th" with text included
    By notrandom in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-10-2013, 05:45 PM
  4. [SOLVED] Userform to accept input from textbox after "return" is pressed
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2012, 06:59 AM
  5. Textbox Lost Functionality - '=EMBED("Forms.TextBox.1","")' missing
    By JoeByrne in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2010, 05:41 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