ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Time format behaviour (https://www.excelbanter.com/excel-programming/307474-time-format-behaviour.html)

Frank Stone

Time format behaviour
 
I'm not sure about this but try it. I think your problem
is the the format you want is not available. to make it
available goto editcellscustom. In the type box enter
HH:mm. now the format is available.

-----Original Message-----
I have a problem where I am copying data from one

worksheet to another and I
am also changing the time format from HH:mm to HHmm. To

do this I am using
this code.

Worksheets("Sheet2").Cells(PasteRow, 16) = Format

(DepTime, "HH" & "mm")

The problem is that the hour figure does not show the

leading zero even
though I have requested it, HH rather than H. The

leading zero is a
requirement. To complicate matters I would only want to

format the cell to
display leading zeros as a last resort. Any ideas would

be most appreciated
.


Tom Ogilvy

Time format behaviour
 
I don't think that is required:

from the immediate window

depTime = #8:26#
? Format(DepTime, "HH" & "mm")
0826

--
Regards,
Tom Ogilvy

"Frank Stone" wrote in message
...
I'm not sure about this but try it. I think your problem
is the the format you want is not available. to make it
available goto editcellscustom. In the type box enter
HH:mm. now the format is available.

-----Original Message-----
I have a problem where I am copying data from one

worksheet to another and I
am also changing the time format from HH:mm to HHmm. To

do this I am using
this code.

Worksheets("Sheet2").Cells(PasteRow, 16) = Format

(DepTime, "HH" & "mm")

The problem is that the hour figure does not show the

leading zero even
though I have requested it, HH rather than H. The

leading zero is a
requirement. To complicate matters I would only want to

format the cell to
display leading zeros as a last resort. Any ideas would

be most appreciated
.





All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com