+ Reply to Thread
Results 1 to 13 of 13

Date format changing

  1. #1
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Date format changing

    This code below was supposed to transfer 2 kinds of date data.
    If I press "Hoje" (It means "today") ribbon, it shall transfer =Today() function to the date column, but I press the "Outra data" (It means "anoter date") ribbon, it shall transfer the date I want (07/02/15, as the print example) to the date collumn. However, when I enter with any "another date", it brings back to the US format (which is different than mine, brazilian). It should be dd/mm/yy (or dd/mm/yyyy), but it is making it mm/dd/yyyy. (I've already check column date format and it's the brazilian one)

    I've already desactivated the autofill option, but it won't work. I think that if each row were independent, there would be no problem.

    This is my code: (I know this is only a part of the code, but I guess I won't be necessary. I needed, I can post it here)
    Please Login or Register  to view this content.

    This is my workbook: (1st image shows the userform with all that options to fill this table below - date option is there. 2nd image is the problem happening, as you can see by the 1st image date value.)
    Attached Images Attached Images
    Last edited by luizmachado; 01-18-2016 at 11:21 PM.

  2. #2
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    Sorry, the data on date textbox is actually 07/02/15, not 02/07/15. I, accidentally, deleted the first image, needing to "create" another one and put the wrong data in it. Anyway, in the first image where you see "02/07/15", is, actually, "07/02/15" (that's how it's changing).
    Forget it. I fixed!
    Last edited by luizmachado; 01-18-2016 at 11:28 PM.

  3. #3
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Date format changing

    You can format the date using the below function...

    Format(Date, "dd/mm/yyyy")

    i.e. Format (DateBox.Text,"dd/mm/yyyy")

  4. #4
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    Quote Originally Posted by spitfireblue View Post
    You can format the date using the below function...

    Format(Date, "dd/mm/yyyy")

    i.e. Format (DateBox.Text,"dd/mm/yyyy")
    I tried it and it's giving me "Syntax error". I basically copy/paste on that code above.

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Date format changing

    Like this...

    Please Login or Register  to view this content.
    What format is DateBox? You probably don't need the .Text
    Last edited by spitfireblue; 01-18-2016 at 11:47 PM.

  6. #6
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    I tried it out, but it didn't work =/. I'm still getting the date format changed.
    DateBox is a textbox on my user form. I tried without .Text and, as you said, it is not needed.
    Quote Originally Posted by spitfireblue View Post
    Like this...

    Please Login or Register  to view this content.
    What format is DateBox? You probably don't need the .Text

  7. #7
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Date format changing

    Can you attach a copy of the workbook?

  8. #8
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    Here it is =)
    Quote Originally Posted by spitfireblue View Post
    Can you attach a copy of the workbook?
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Date format changing

    Here you go. Your problem was that DateBox was coming through as text

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    It worked!!!!! Thank you =)

  11. #11
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    I was working till now, but it won't keep the "dd/mm/yyyy" format for every other sheet.

    This is a part of the actual code:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    It was working till now*

    And this is a part of the entire code, if needed:
    Please Login or Register  to view this content.
    This is my workbook, if needed (larger than 1000kb): https://www.dropbox.com/s/i8gsssg89m...2016.xlsm?dl=0

  13. #13
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Date format changing

    Oh, sorry!
    I forgot to write DateValue before the actual date.
    It is, basically:

    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. [SOLVED] Formula for Changing date format 3-12-13 to format d-mm-yy.
    By UNAB in forum Excel General
    Replies: 2
    Last Post: 04-08-2013, 03:52 PM
  2. [SOLVED] Changing Multiple sheet names by wk ending date for yr but need specific name/date format
    By kedeling in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2013, 02:40 PM
  3. Need help changing date to a sortable date format
    By slicksilver79 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 12-15-2011, 10:44 AM
  4. VB changing date format
    By superbob in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-25-2010, 11:14 AM
  5. date format keeps changing
    By buckau in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-25-2009, 12:50 AM
  6. Formula required for date without changing the date format
    By suryaprasad in forum Excel General
    Replies: 1
    Last Post: 01-28-2009, 08:04 AM
  7. Changing Format of Date
    By andrewc in forum Excel General
    Replies: 3
    Last Post: 04-23-2008, 07:11 AM
  8. Changing date serial numbers to date format
    By rdunne in forum Excel General
    Replies: 1
    Last Post: 04-14-2005, 08:06 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