+ Reply to Thread
Results 1 to 3 of 3

Converting Text dates into dates

  1. #1
    EAB1977
    Guest

    Converting Text dates into dates

    Hello everyone,

    I am having a issue that I hope someone can help me with

    I have a Excel sheet that, when completed, uploads to a Lotus Notes
    database and the proper recipients are notified. I am having some
    trobule converting the text dates into real dates. The code works about
    90% of the time, but I would like it to work ALL the time.

    The text dates can have 3 dates.

    1/1/2006 = 8 chrs
    1/11/2006 = 9 chrs
    11/11/2006 = 10 chrs

    To convert this to useable dates, I do the following:

    datFirst = Trim(Left(Range("C6").Value, 10))
    datLast = Trim(Right(Range("C6").Value, 10))

    ....because the dates can look like this:

    1/1/2006 to 11/11/2006

    When I use the code as typed, I get a data error that there is a Type
    Mismatch, and I know why that is since if you take the first part of
    the code (datFirst), it would come out as 1/1/2006 t.

    Is there anyway I can eliminate this? Or am I S.O.L.?


  2. #2
    Arvi Laanemets
    Guest

    Re: Converting Text dates into dates

    Hi

    Select the range with dates. Format as General. From Data menu, select (with
    dates range remaining selected) TextToColumns. Finish.


    Arvi Laanemets



    "EAB1977" <[email protected]> wrote in message
    news:[email protected]...
    > Hello everyone,
    >
    > I am having a issue that I hope someone can help me with
    >
    > I have a Excel sheet that, when completed, uploads to a Lotus Notes
    > database and the proper recipients are notified. I am having some
    > trobule converting the text dates into real dates. The code works about
    > 90% of the time, but I would like it to work ALL the time.
    >
    > The text dates can have 3 dates.
    >
    > 1/1/2006 = 8 chrs
    > 1/11/2006 = 9 chrs
    > 11/11/2006 = 10 chrs
    >
    > To convert this to useable dates, I do the following:
    >
    > datFirst = Trim(Left(Range("C6").Value, 10))
    > datLast = Trim(Right(Range("C6").Value, 10))
    >
    > ...because the dates can look like this:
    >
    > 1/1/2006 to 11/11/2006
    >
    > When I use the code as typed, I get a data error that there is a Type
    > Mismatch, and I know why that is since if you take the first part of
    > the code (datFirst), it would come out as 1/1/2006 t.
    >
    > Is there anyway I can eliminate this? Or am I S.O.L.?
    >




  3. #3
    Gary''s Student
    Guest

    Re: Converting Text dates into dates

    Another solution is to use =DATEVALUE() function in the worksheet. It does a
    very good job of converting text strings into dates.

    Just be sure to format the cell containing the function as date.
    --
    Gary''s Student


    "Arvi Laanemets" wrote:

    > Hi
    >
    > Select the range with dates. Format as General. From Data menu, select (with
    > dates range remaining selected) TextToColumns. Finish.
    >
    >
    > Arvi Laanemets
    >
    >
    >
    > "EAB1977" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello everyone,
    > >
    > > I am having a issue that I hope someone can help me with
    > >
    > > I have a Excel sheet that, when completed, uploads to a Lotus Notes
    > > database and the proper recipients are notified. I am having some
    > > trobule converting the text dates into real dates. The code works about
    > > 90% of the time, but I would like it to work ALL the time.
    > >
    > > The text dates can have 3 dates.
    > >
    > > 1/1/2006 = 8 chrs
    > > 1/11/2006 = 9 chrs
    > > 11/11/2006 = 10 chrs
    > >
    > > To convert this to useable dates, I do the following:
    > >
    > > datFirst = Trim(Left(Range("C6").Value, 10))
    > > datLast = Trim(Right(Range("C6").Value, 10))
    > >
    > > ...because the dates can look like this:
    > >
    > > 1/1/2006 to 11/11/2006
    > >
    > > When I use the code as typed, I get a data error that there is a Type
    > > Mismatch, and I know why that is since if you take the first part of
    > > the code (datFirst), it would come out as 1/1/2006 t.
    > >
    > > Is there anyway I can eliminate this? Or am I S.O.L.?
    > >

    >
    >
    >


+ 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