+ Reply to Thread
Results 1 to 3 of 3

Macro to convert Numbers into Dates

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    88

    Macro to convert Numbers into Dates

    Hi Guys,

    I need help to edit the current code or create a new code to convert numbers in 6 digit format into dates. Format is DDMMYY.

    The current code I use as shown below crops up with run time error 13, mismatch error.

    The problem is on the line "sDate = Format(target.Value, "000000")"

    Please Login or Register  to view this content.
    Please help out. Thanks.

  2. #2
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Macro to convert Numbers into Dates

    Hi Rocksan,

    If i create a new sheet called tmp, and add e.g. 020111 in cell A1, I have no problems running your code.
    What is in your A1 cell?

    Regards,
    Rkey

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Macro to convert Numbers into Dates

    Hi Rkey

    Yes, in a new environment, e.g a clean worksheet, the problems dont occur. I suspect it is because the datasheet im using the formula on is extracted from a text import query.

    Im trying to write a code to break that external link so that it only copies the values then run the code on it thereof. it is a bit of a hassle, thats why I asked here if anyone has a better code, or an alternative solution.

+ 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