Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format Time
Option Explicit
Sub testme() Dim RangeTotals As Double RangeTotals = 27.1998611111111 'my test data! With ActiveCell.Offset(0, 6) .NumberFormat = "[hh]:mm:ss" .Value = RangeTotals End With End Sub stottle wrote: Hello, I have totalled up a column of cells which contain a time and when i highlight all the cells and use the sum option in the bottom right of excel (it gives you the option of sum, max, min, ave etc if you right click there) it shows the value 652:47:46 (652 hours, 47 minutes and 46 seconds). But when i use the format function in VBA, I get 04:47:48 (RangeTotals is Variant which contains the number I would like to display) ActiveCell.Offset(0, 6).Value = Format(RangeTotals, "Long Time") When the time is formatted as a decimal i get 27.1998611111111. Can someone help me so that the activecell value = 652:47:46 instead of 04:47:48. Many Thanks Stuart -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to format time in decimal format & calculate time | Excel Discussion (Misc queries) | |||
How to format time in decimal format & calculate time | Excel Discussion (Misc queries) | |||
How to format time in decimal format & calculate time | Excel Discussion (Misc queries) | |||
How to type format time in decimal format & calculate time | Excel Discussion (Misc queries) | |||
Remove time from a date and time field? Format removes the displa. | Excel Worksheet Functions |