+ Reply to Thread
Results 1 to 3 of 3

Date Formatting

  1. #1
    langron
    Guest

    Date Formatting

    I have an interesting problem. I have column "E" on my spreadsheet that shows
    all cells with a comment tick with the information, 'Text Date with a 2-digit
    Year'. But when I try to programmatically correct this with a command like -

    ActiveSheet.Columns("E").NumberFormat = "mm/dd/yyyy"

    The format doesn't change my dates to reflect a four year digit. It will
    only change if I format another cell that has no comment tick and actually
    type in a date. Even if I copy and paste special-values into the other cell,
    the format remain in the 2-digit year.

    Anyone with a fix?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Langron,

    Remove the tick marks and your code should work fine.

    Sincerely,
    Leith Ross

  3. #3
    Dick Kusleika
    Guest

    Re: Date Formatting

    Langron

    I doubt that the comment has anything to do with it - although what the
    comment says probably does. I think you have text in the cells that looks
    like a date, not an actual date. No matter how you change the number
    format, the textdate won't change because it's text and not a number.

    In the UI, after you change the format, hit F2 and enter to convert the text
    to a number. In code, it would be

    Range("E1").NumberFormat = "mm/dd/yyyy"
    Range("E1").Value = Range("E1").Value

    --
    **** Kusleika
    Excel MVP
    Daily Dose of Excel
    www.*****-blog.com

    langron wrote:
    > I have an interesting problem. I have column "E" on my spreadsheet
    > that shows all cells with a comment tick with the information, 'Text
    > Date with a 2-digit Year'. But when I try to programmatically correct
    > this with a command like -
    >
    > ActiveSheet.Columns("E").NumberFormat = "mm/dd/yyyy"
    >
    > The format doesn't change my dates to reflect a four year digit. It
    > will only change if I format another cell that has no comment tick
    > and actually type in a date. Even if I copy and paste special-values
    > into the other cell, the format remain in the 2-digit year.
    >
    > Anyone with a fix?




+ 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