+ Reply to Thread
Results 1 to 10 of 10

Date problem - European/American formatting

  1. #1
    Registered User
    Join Date
    04-25-2006
    Posts
    25

    Date problem - European/American formatting

    Hi,

    After copying a range of records (containing a.o. dates) to another (=destination) sheet, the date format, originally in dd/mm/yyyy format, changes to mm/dd/yyyyy for those dates with an original dd < 13. This means that 07/01/2014 (dd/mm/yyyy) becomes 01/07/2014 in the destination sheet.
    The regional settings on my computer at set to 'British' being dd/mm/yyyy.

    Any thoughts what I've been overlooking while copying/storing?

    Thanks for your help
    Eric

    Just to be more specific on the copying: I've move the 'source' records to an array and then drop the array in the destination sheet.
    Do I need to format the date in the array as a string before dropping the array ?
    Last edited by bdn435; 08-10-2014 at 04:02 AM. Reason: Update

  2. #2
    Registered User
    Join Date
    06-21-2013
    Location
    Wiltshire, UK
    MS-Off Ver
    365 Version 2210 Build 16.0.15726.20070
    Posts
    72

    Re: Date problem - European/American formatting

    The age old issue with dates

    If you have access to the original data still, add 3 extra columns for Day(), Month() and Year(). Copy the data over and rebuild the dates using the Date() function on the 3 extra columns.
    Isskint, i get satisfaction out of helping others

  3. #3
    Registered User
    Join Date
    04-25-2006
    Posts
    25

    Re: Date problem - European/American formatting

    Thanks! Seems an inevitable 'workaround' but a good solution.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Are the date values changing or is it just the formatting?

    Also, how are you copying/pasting?
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    04-25-2006
    Posts
    25

    Re: Date problem - European/American formatting

    The value are changing.

    I'm building a (variant) array with the records and then drop the array into a range in the destination workbook.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date problem - European/American formatting

    Eric

    What format are the dates in the array, before you drop them in the range?

  7. #7
    Registered User
    Join Date
    04-25-2006
    Posts
    25

    Re: Date problem - European/American formatting

    Hi Norie,

    Thanks for taking such an interest in my problem.
    Just debug.printed the array and the dates are in the dd/mm/yyyy format (as in the source sheet)

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date problem - European/American formatting

    I can't recreate the problem, do you have 'real' dates on the source sheet?

    In the array are the values enclosed in #s?

    PS For that last bit you'll need to look in the Watch Window.

  9. #9
    Registered User
    Join Date
    04-25-2006
    Posts
    25

    Re: Date problem - European/American formatting

    Hi Norie & Co,

    Seems that the following solution works

    - Store the date field from the source sheet in the (2D) array with a .value2 property - in english: MyVariant(a,b) = MyCell.Value2 . This stores the date as a dateserial
    - Format the range with the dateserials in the destination sheet as dates - in english MyRange.NumberFormat = "dd-mm-yyyy"

    The inspiration for this solution comes from the following tread:
    http://www.mrexcel.com/forum/excel-q...ray-range.html

    and see also
    http://stackoverflow.com/questions/1...lue-and-value2

    and also
    http://www.excelforum.com/excel-prog...nd-value2.html

    Regards
    Eric

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date problem - European/American formatting

    Oops, misread - thought it was a different post.

+ 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. European-American date issues within a macro that loops
    By vbahelp12 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2012, 09:04 AM
  2. European vs. American date formats messing up autosort
    By theradpotato in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-07-2010, 02:11 PM
  3. Birtish Vs American date Macro problem
    By damo_uk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2009, 11:42 AM
  4. Another date as European problem
    By heinousanus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-23-2006, 07:43 AM
  5. European vs American decimals
    By Tobey in forum Excel General
    Replies: 1
    Last Post: 10-13-2005, 03: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