+ Reply to Thread
Results 1 to 7 of 7

Get dates reversed

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Get dates reversed

    Hello everybody
    I have the following code that extract unique values and sort these values
    Please Login or Register  to view this content.
    When I use this code to extract unique dates from the range("B2:B" & LastRow) I found that day and month reversed
    For example
    1 Dec. , 2014 became 12 Jan. , 2014
    s there a way to correct this undesired output?
    I tried to put CDate in different position but I failed

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Get dates reversed

    Try this:-
    Change date format in code to suit !!
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Get dates reversed

    Mr. Mick
    the same problem is still there

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Get dates reversed

    Pity it worked for me!!!
    Can you send your file or example of it.

  5. #5
    Forum Contributor
    Join Date
    09-17-2014
    Location
    UK
    MS-Off Ver
    2007
    Posts
    117

    Re: Get dates reversed

    I had the same issue on a userform where it would reverse all dates up to 12/xx/xxxx and anything >12, it formatted as text and lost the actual value.

    I originally worked around it similar to MickG's solution (which incidentally has also worked for me) by keeping as a number format whilst processing the data:

    R.NumberFormat = "00000"

    and then setting the format of the particular column to "dd-mmm-yy" using right click and format cells.

    From my observations (and I'm always wrong according to the missus......) Excel doesn't seem to care what formatting you choose at any point of the processing of these fields, however when it comes to the final 'write' process (usually the copy/paste), if the format isn't specified at that point, then excel does what it pleases which is to use it's native US format.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Get dates reversed

    Mr. Mick
    Your code now works perfect. I didn't notice all the modifications on the code..
    It now works well
    Thanks a lot for this great help
    And thanks a lot Mr. BuZZarD73

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Get dates reversed

    You're welcome

+ 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. Operators reversed
    By jacksonville in forum Excel General
    Replies: 2
    Last Post: 12-14-2009, 06:57 PM
  2. vlookup reversed
    By market man in forum Excel General
    Replies: 2
    Last Post: 02-07-2007, 10:56 AM
  3. [SOLVED] columns reversed
    By lou in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-14-2006, 12:45 PM
  4. Cells() produces reversed date format for double digit dates
    By tarns in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2006, 09:10 PM
  5. [SOLVED] reversed columns
    By Vulcan in forum Excel General
    Replies: 2
    Last Post: 06-29-2005, 10: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