Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default 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" wrote in message
oups.com...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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" wrote in message
oups.com...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Text to Dates OxonLad Excel Worksheet Functions 4 June 25th 08 10:02 PM
converting text strings into dates via135 Excel Worksheet Functions 6 November 18th 07 01:50 PM
Converting Text Values to Dates Frank Winston Excel Discussion (Misc queries) 12 June 5th 06 11:35 AM
imported text data converting to dates ajd Excel Discussion (Misc queries) 2 December 21st 05 06:48 PM
Converting text to dates Jack Excel Discussion (Misc queries) 2 April 25th 05 07:36 PM


All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"