+ Reply to Thread
Results 1 to 11 of 11

convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

  1. #1
    Registered User
    Join Date
    07-01-2012
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    96

    convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    can the date be changed from MM/DD/YYYY to DD/MM/YYYY while the format of data is `text`instead of `date`? I still need the data in `text`format, but I have to use a macro to change the order of days and months. Previously I changed the format from `date`to `text`by using the following code:



    Please Login or Register  to view this content.
    and I think it would be easier to manipulate this code to obtain the result that is desired.
    Thanks in advance for your help,

    Karol

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    Please Login or Register  to view this content.
    will this do?
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  3. #3
    Registered User
    Join Date
    07-01-2012
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    nope, it doesn`t. And it can be applicable to only one cell.

    When I used that code 27/03/2008 became 7//3//008

  4. #4
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    Quote Originally Posted by Vogelmann View Post
    nope, it doesn`t. And it can be applicable to only one cell.

    When I used that code 27/03/2008 became 7//3//008
    Dunno, seems to be working for me.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-01-2012
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    cut zeros from the beginning, e.g. 5/23/1975, 4/10/1988, that`s how my dataset looks like. I tried it in your file and after deleting zeros it doesn`t work.

  6. #6
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    Sorry, there was no mention of no "0's".

    Please Login or Register  to view this content.
    Last edited by Bishonen; 10-18-2012 at 07:11 AM.

  7. #7
    Registered User
    Join Date
    07-01-2012
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    after editing, your code produces the following error:

    `Invalid procedure call or argument`

    and then the following row is highlighted:

    Please Login or Register  to view this content.
    besides this, it still cuts numbers, e.g. 2/4//200 instead of 4/25/2008.
    Last edited by Vogelmann; 10-18-2012 at 07:26 AM.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    Try this
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    the msgbox' were for debuging. I thought that the last one worked ^^ This one does for sure though:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    07-01-2012
    Location
    Tilburg, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    jindon - your code works, though it changes the format to `custom` instead of `text`

    Bishonen - what if my range is G7:G ? I cannot apply your code to that range, could you help me?
    Last edited by Vogelmann; 10-18-2012 at 10:59 AM.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: convert MM/DD/YYYY to DD/MM/YYYY while the data format is text

    Quote Originally Posted by Vogelmann View Post
    jindon - your code works, though it changes the format to `custom` instead of `text`
    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)

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