24 hour time

G

Guest

This is what I have so far. I type the start date/time (04/24/06 13:00) and
stop date/time into an input box using a 24-hour clock. Later in the code it
brings up an input box from date1 to date2, etc. In this input box it
switches to using AM and PM. How do I get the input box to keep the 24 hour
clock?

Here's the part that shows Date1 (in column N) to Date2 (in column O):

Range("I" & a - 1).Value = InputBox("Enter MW Amount for period " &
Range("N" & a - 1) & " to " & Range("O" & a - 1))

Any help is appreciated. :)
 
A

Ardus Petus

Cells(a - 1, "I").Value = InputBox( _
"Enter MW Amount for period " & _
Format(Cells(a - 1, "N"),"mm/dd/yy hh:mm") & " to " & _
Format(Cells(a - 1, "O"),"mm/dd/yy hh:mm")

HTH
 
H

Harald Staff

Hi

You don't say Range(x).What, just Range(x) , so it uses default, which is
Value. Use
Range("N" & a - 1).Text
to get what the cell actually displays. (AP's solution may be better suited
though, it doesn't change if the user reformat the cells in question.)

I do mean "actually displays", it will read ### if the column is too narrow
to display its real content.

HTH. Best wishes Harald
 
G

Guest

Works great! Thanks guys.

Ardus Petus said:
Cells(a - 1, "I").Value = InputBox( _
"Enter MW Amount for period " & _
Format(Cells(a - 1, "N"),"mm/dd/yy hh:mm") & " to " & _
Format(Cells(a - 1, "O"),"mm/dd/yy hh:mm")

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top