+ Reply to Thread
Results 1 to 5 of 5

Trouble Formatting Dates

Hybrid View

jpgoeth Trouble Formatting Dates 05-25-2007, 02:00 PM
Paul If all your dates are in one... 05-25-2007, 11:06 PM
Richard Schollar Hi Easiest way would be to... 05-26-2007, 04:01 AM
Json Just a thought... 05-26-2007, 04:20 AM
jpgoeth Thanks! 05-29-2007, 10:20 AM
  1. #1
    Registered User
    Join Date
    02-28-2007
    Posts
    29

    Trouble Formatting Dates

    I'm extracing some data from a database, and the dates I get are in the format yyyy/mm/dd. When I go to "format cells" and change the format to dd/mm/yyyy (or any other format), the values don't change unless I go and double-click the cell to edit it.

    Why is this happening? Is there a way to fix it?

    JP

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    If all your dates are in one column, you can run this macro in a module to update them all at once:
    Sub updateDates()
        Dim i, iLastRow As Long    
        iLastRow = Range("A65536").End(xlUp).Row
        For i = 1 To iLastRow
            Cells(i, 1).Value = Cells(i, 1).Value
        Next i    
    End Sub
    This code assumes your dates are in column A, from row 1 through x. If your data is elsewhere you'll need to change the following:
    Red text above are column references. Change those to match your column. (The 1's represent the first column, or A. So column E would be 5, etc.)
    Blue text above represents the starting data row. If your data starts in another row, change it to that.

  3. #3
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Hi

    Easiest way would be to select the column that contains these 'dates' and go Data>TextToColumns>Next>Next>and choose a Column Data Format of Date (YMD from the dropdown) and click Finish.

    Hope this helps!

    Richard

  4. #4
    Registered User
    Join Date
    11-30-2006
    Location
    UK
    MS-Off Ver
    Microsoft Office XP
    Posts
    61

    Question Just a thought...

    You have got auto updates on an the calculations tab haven't you?

    Sorry if you've already checked, would be a nice simple solution though.

    Jason

  5. #5
    Registered User
    Join Date
    02-28-2007
    Posts
    29

    Smile Thanks!

    Thanks for your input, everyone.

    I used Richard's idea - I had never even noticed the TextToColumns option in the data menu.

+ 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