View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Convert to military time - part II

The key issue would be if the pasted data is stored as a date or a string.

It is unclear how subtracting provides what most people would describe as a
total.

--
Regards,
Tom Ogilvy

"Carole O" wrote in message
...
The data is coming from a Crystal Report format (copy and paste into Excel
2003). I want to be able to subtract MM/DD/YYYY H:mm:ss AM/PM formatted
cells to get total work hours. I think I would have to convert the time

part
of the cell to military time in order to do the subtraction. I will try

your
suggestion. Thanks for your help!

Carole O

"sebastienm" wrote:

Please, disregard my previous post.

-What is your input:
you have a date data type variable or a date in a string ? if string, in
which format?
-What do you want as output:
a string (containing a date) formatted as MM/DD/YYYY H:mm:ss AM/PM ?

I suppose you can use the Format function. Example:
Dim d as date
d=Now()
msgbox "US: " & format(d, "mm/dd/yyy h:mm:ss AM/PM")
msgbox "Military: " & format(d, "mm/dd/yyy h:mm:ss")

Regards,
Sebastien

"Carole O" wrote:

I am trying to convert MM/DD/YYYY H:mm:ss AM/PM to military time. I

copied
the macro provided by Bernie Deitrick to Soccer Star, and got the same

error
message with ..Value = TimeValue(TimeStr). I've named the start time
TimeStr, but don't know what to do next.

TIA,

Carole O