![]() |
Time displaying as decimal
I am working on some macros to automate charting and am having trouble with
the column that contains the times (x values). In particular, the column is formatted as type "Custom hh:mm" and so I simply tried the following: strDateStart = ActiveCell.Value which returns a decimal time. I have tried applying the TimeValue function to the cell contents strDateStart = TimeValue(ActiveCell.Value) but it gives me a type mismatch error. Could anyone please shed any light on this. Thanks a lot P.S. The Excel spreadsheet has been itself auto-generated via a third party Delphi application. So I cannot control the original format of the source data. |
Time displaying as decimal
The value is a fractional amount - that's how XL stores times, as
fractional days. You could use strDateStart = ActiveCell.Text if you want to rely on the cells' formatting. Or you might try strDateStart = Format(ActiveCell.Value, "hh:mm") to make sure you have the format you want. In article , "MauroBCT" wrote: I am working on some macros to automate charting and am having trouble with the column that contains the times (x values). In particular, the column is formatted as type "Custom hh:mm" and so I simply tried the following: strDateStart = ActiveCell.Value which returns a decimal time. I have tried applying the TimeValue function to the cell contents strDateStart = TimeValue(ActiveCell.Value) but it gives me a type mismatch error. Could anyone please shed any light on this. Thanks a lot P.S. The Excel spreadsheet has been itself auto-generated via a third party Delphi application. So I cannot control the original format of the source data. |
Time displaying as decimal
Obvious isn't it ;- ? Thanks very much for your help.
"JE McGimpsey" wrote: The value is a fractional amount - that's how XL stores times, as fractional days. You could use strDateStart = ActiveCell.Text if you want to rely on the cells' formatting. Or you might try strDateStart = Format(ActiveCell.Value, "hh:mm") to make sure you have the format you want. In article , "MauroBCT" wrote: I am working on some macros to automate charting and am having trouble with the column that contains the times (x values). In particular, the column is formatted as type "Custom hh:mm" and so I simply tried the following: strDateStart = ActiveCell.Value which returns a decimal time. I have tried applying the TimeValue function to the cell contents strDateStart = TimeValue(ActiveCell.Value) but it gives me a type mismatch error. Could anyone please shed any light on this. Thanks a lot P.S. The Excel spreadsheet has been itself auto-generated via a third party Delphi application. So I cannot control the original format of the source data. |
All times are GMT +1. The time now is 07:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com