Results 1 to 20 of 20

Macro to convert dates format from yyyy mm dd to yyyy-mm-dd

Threaded View

  1. #1
    Registered User
    Join Date
    02-27-2008
    Posts
    18

    Macro to convert dates format from yyyy mm dd to yyyy-mm-dd

    Hello,

    I have a 20,000 line Excel sheet...
    And all the dates are entered like this:
    2009 02 08

    I want to add a dash, so they look like this
    2009-02-08


    so I added a command button, and this code, but its not searching the sheet and adding the dash's...Can anyone help?
    Private Sub CommandButton1_Click()
    Range("A1").Select
    Selection.NumberFormat = "yyyy mm dd" 'Date as10/06/2005
    Selection.NumberFormat = "yyyy/mm/dd" 'Date as 10-Jun-2005
    Range("D1").Select
    Selection.NumberFormat = "@" 'Text
    End Sub
    Last edited by VBA Noob; 02-25-2009 at 05:45 PM.

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