+ Reply to Thread
Results 1 to 11 of 11

date dd/mm reverts to mm/dd

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    date dd/mm reverts to mm/dd

    Hi the following code relates to a userform which on initialize picks up a date from a hidden worksheet. if the date is within the userform it then posts the changes to the same cell.

    the problem I'm having is each time the commandbutton is clicked, regardless of whether changes are made the date reverts to and from dd/mm/yyyy - mm/dd/yyyy

    Please Login or Register  to view this content.
    it is the textbox2 i am concerned with.

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: date dd/mm reverts to mm/dd

    I may be missing something but try this...

    change the "dd/mm/yyyy" to "mm/dd/yyyy"
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    Re: date dd/mm reverts to mm/dd

    Hi, Sorry no this does not work.

    The problem is it switches each time, from dd/mm then I click the command button and it is mm/dd. the next time the button is pressed it changes again.

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: date dd/mm reverts to mm/dd

    can you upload the file....sometimes it's easier to troubleshoot that way....please remove any company confidential stuff....

  5. #5
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    Re: date dd/mm reverts to mm/dd

    hello - i am sorry for the delay. Please find example workbook attached. When the userform is displayed it should show the dates from the worksheet, which it does.

    Any changes to the dates when the userform is shown should then transfer to the worksheet when the commandbutton is pressed, which it does.

    The only problem is that the DD/MM format changes to and from MM/DD each time the command button on the userform is pressed.

    sample file attached.

    thanks in advance.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: date dd/mm reverts to mm/dd

    Rather than trying to format, let VBA figure out what's what with the dates according to your computer settings.

    If you convert the text in a textbox to a date before writing to the worksheet, it will be written correctly:
    Please Login or Register  to view this content.
    Last edited by cytop; 01-28-2014 at 09:07 AM.

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: date dd/mm reverts to mm/dd

    Try this.

    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  8. #8
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    Re: date dd/mm reverts to mm/dd

    Hi yes, that's great thank you. However, one problem is that now if i clear the dates on the userform to post blank entries to the worksheet then I get an mismatch error?

    How do I correct this?

    What is the significance of "Me" in the code?

    thanks again.
    Last edited by dantray02; 01-28-2014 at 09:53 AM.

  9. #9
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: date dd/mm reverts to mm/dd

    Let's say that is the id of the textbox!..So.

    You are welcome and thanks for the feed back.

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED,as per Forum Rule #9. Thank you.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  10. #10
    Registered User
    Join Date
    01-08-2014
    Location
    wigan
    MS-Off Ver
    2007
    Posts
    78

    Re: date dd/mm reverts to mm/dd

    hi, sorry - i will mark as solved and thank you. however, i had edited my last post no doubt whilst you were writing that so not quite solved yet.

    thanks again in advance.

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: date dd/mm reverts to mm/dd

    1 way could be this.

    Please Login or Register  to view this content.

+ 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. tab reverts back to file
    By ketanco in forum Excel General
    Replies: 10
    Last Post: 09-12-2018, 04:02 PM
  2. Excel Links - Reverts to old file
    By mimimsmom in forum Excel General
    Replies: 1
    Last Post: 01-08-2014, 01:06 PM
  3. Macro reverts to Function
    By Ricardo9211 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-26-2010, 05:22 PM
  4. [SOLVED] Excess text reverts to ######## , any way around this?
    By niamh in forum Excel General
    Replies: 1
    Last Post: 04-12-2006, 12:10 PM
  5. UDF Name Reverts to Lower Case
    By silver23 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2005, 03:06 PM

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