Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Cell Data Types (Date vs. Double)

Hello All:

I have a spreadsheet with two columns both containing serial date/time.
Column A is formatted using a valid date format and column B is formatted
using a valid time format.

If I use the following:

SourceArray = Range.Value
Assuming that Range is a selection of two columns and at least one row.

TypeName(SourceArray(1,1))
returns Date
TypeName(SourceArray(1,2))
returns Double

Does Excel not evaluate a column formatted as time to be a valid portion of
a date and therefore type the value as a Date?

Any insight would be greatly appreciated.

Mike.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Data Types (Date vs. Double)

Don't really know the answer, but VBA obligingly changes data types to
whatever the variable is formatted to. This can be very useful, for
example, when wanting to convert Text to numbers or vice versa.

Perhaps, in this case, it recognises your date data as such and does
its thing (because it just loves to convert dates to American mm/dd/yy
) but does not recognise Times.

"It's a feature, not a bug."


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Cell Data Types (Date vs. Double)

Everyone:

Brian, thank you for you response.

The following is a debug.print of the values I am working with.

Before Format: 37417.3433796296, 37417.3433796296
After Format: 10/06/2002 8:14:28 AM, 37417.3433796296

Format Strings: dd/MM/yyyy, h:mm:ss

Notice how the Col A value has been converted when a date format is applied
but the Col B value remains unchanged.

"BrianB " wrote in message
...
Don't really know the answer, but VBA obligingly changes data types to
whatever the variable is formatted to. This can be very useful, for
example, when wanting to convert Text to numbers or vice versa.

Perhaps, in this case, it recognises your date data as such and does
its thing (because it just loves to convert dates to American mm/dd/yy
) but does not recognise Times.

"It's a feature, not a bug."


---
Message posted from http://www.ExcelForum.com/



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
Two types of Data Validation in a cell? Lakeville Excel Worksheet Functions 9 January 15th 12 04:00 AM
Need to double-click for data to be recognised as date?! HierkommtdieMau Excel Discussion (Misc queries) 3 March 28th 06 11:17 AM
Mixed data types in a cell camell Excel Discussion (Misc queries) 2 March 8th 06 08:36 PM
double click a cell with Date format qqxz Excel Discussion (Misc queries) 1 January 24th 06 02:41 PM
date data types Bill[_19_] Excel Programming 2 January 26th 04 02:46 PM


All times are GMT +1. The time now is 05:04 PM.

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"