Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Two types of Data Validation in a cell? | Excel Worksheet Functions | |||
Need to double-click for data to be recognised as date?! | Excel Discussion (Misc queries) | |||
Mixed data types in a cell | Excel Discussion (Misc queries) | |||
double click a cell with Date format | Excel Discussion (Misc queries) | |||
date data types | Excel Programming |