+ Reply to Thread
Results 1 to 9 of 9

Dates error format

  1. #1
    Registered User
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    4

    Question Dates error format

    Hi,

    I have an excelsheet with data that I extract from an online source. I have assigned a VBA code to this sheet in order to write some of these data in a new sheet. Some data are dates which i am taking in a wrong format. For example, I am taking dates in United Kingdom format (dd/mm/yyyy) and some other are shown as number. When I change the format of these numbers to dates I take the United States format (mm/dd/yyyy). I would like to have all the dates in (dd/mm/yyyy) United kingdom format.

    Could you please help me with that?
    Do you know if this an error that VBA code creates?
    Is there any code that i can run to solve this error?

    Thank you in advance.

    Georgia.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Dates error format

    Just change your Short date setting in control panel to dd/mm/yyyy


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: Dates error format

    Hi, thanks for your reply. The short date has already this format dd/mm/yyyy.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Dates error format

    What happens if you press F2 and enter on those cells (Manually)??

  5. #5
    Registered User
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: Dates error format

    When i do it manually i am taking the dd/mm/yyyy format but the problem is still the same. When I run the code some dates are in dd/mm/yyyy format and some others mm/dd/yyyy. This happens when the format of this column is set up as dates. If I choose the general as format for the column with the dates I take dates either with dd/mm/yyyy or as number. I would like to have the same format (dd/mm/yyyy) for all the dates in this column.

    I am not sure if the code creates this error or it is an excel error in general.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Dates error format

    Because the dates which resides in the cells/range is not real date. It is a Text Date. So convert it to real Date so that you will get rid off this issue

  7. #7
    Registered User
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: Dates error format

    I changed all the dates to real Date in the sheet1. I have assigned the VBA code to sheet1 which write some of these dates in sheet2. I have also changed the format of column2 (data with dates) to real Date in sheet2 but i am taking either the dd/mm/yyyy or mm/dd/yyyy format in the column2. The most strange thing is that the sheet1 has all the dates with format dd/mm/yyyy.

    What i could like is the format in sheet2 column2 will be the same for each date (dd/mm/yyyy). Hope that i explain it clearly.
    thanks

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dates error format

    How do you extract the data from the online source? Manually or in code? Also, what is the code you are using currently to transfer the data to Sheet2?
    Remember what the dormouse said
    Feed your head

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,323

    Re: Dates error format

    I suspect that all the dates are American format, mm/dd/yy. Some will "look like" UK dates and be interpreted as UK dates, others won't.

    So, for example, if the date is 10/11/15, as an American date, this will read as October 11 2015. But, as a UK date, it will read as 10 November 2015.

    So, where the day and month can "reasonably" be interchanged, you have a "valid" but wrong date. Where the date is, say, 10/14/15, as an American date, it will read as October 14 2015 ... BUT it cannot be interpreted as a valid UK date because there is no month 14.

    So, if you have a column of dates, you should convert them all to UK dates. You can do this with text to Columns.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. VBA Form is sumbitting dates as USA Format - I need UK format
    By scottmcclean in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-04-2014, 03:37 AM
  2. Convert Dates in 2011:08:17 format into Dates in Excel
    By JessRI in forum Excel - New Users/Basics
    Replies: 12
    Last Post: 09-11-2012, 09:55 AM
  3. Conditional Format Dates in a Calender when Matches dates in a list
    By Lungfish in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-14-2009, 06:23 AM
  4. Format text 'dates' to real dates
    By Jacy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-23-2006, 09:15 PM
  5. [SOLVED] [SOLVED] the dates on cell format make different dates.
    By date formats morph the dates/chang case in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 04-17-2005, 10:07 PM

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