+ Reply to Thread
Results 1 to 7 of 7

Macro changing date format when doing find and replace

  1. #1
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Sydney,Australia
    MS-Off Ver
    Excel 2010
    Posts
    100

    Macro changing date format when doing find and replace

    Hi All,

    My macro is changing date by mistake when doing find (.) and replace (/) in the date column
    here is example date 9/02/2013. This date changes to 2/09/2013 after running the macro.

    Please Login or Register  to view this content.
    Can some one please help!
    Thanks

  2. #2
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Sydney,Australia
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Macro changing date format when doing find and replace

    Hi All,

    My macro is changing date by mistake when doing find (.) and replace (/) in the date column
    here is example date 9/02/2013. This date changes to 2/09/2013 after running the macro.

  3. #3
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Macro changing date format when doing find and replace

    Try...

    Please Login or Register  to view this content.
    If the month and date are still reversed, check that your system's regional date format is set for day/month format.

  4. #4
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Sydney,Australia
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Macro changing date format when doing find and replace

    HI Jhren It still does the same. date is set to day/month format as well.

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Macro changing date format when doing find and replace

    Would you be so kind as to post a sample file...???

  6. #6
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Sydney,Australia
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Macro changing date format when doing find and replace

    Thank You for your time Jhren! Please have a look at this file. It works when I do it manually but not
    with the code.

    Thanks.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Macro changing date format when doing find and replace

    The code I posted above works for me....

    Because I'm in the USA, I opened my system's Regional settings and change my date format to d/M/yyyy, open your file, run my code and all's fine with the ouput (though there's a mismatch error for the code because of the header in A1).

    As I said in Post#3, make sure your system's Regional and Language Options date format set to day/month (e.g. d/M/yyyy). This setting is not the date formatting of cells in Excel. The Regional setting is accessed though system Control Panel.

+ 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. Find and Replace (with changing date) in macro
    By mattrp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2011, 03:23 PM
  2. Replies: 3
    Last Post: 01-27-2011, 08:19 PM
  3. Find and replace the date format in Word file
    By vinwin06 in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2010, 09:11 PM
  4. Replies: 2
    Last Post: 08-26-2009, 06:50 PM
  5. [SOLVED] Date format changing on edit > replace
    By cdb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2005, 07:05 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