military time formatting...

S

sbowman

I have a create, edit, delete program I've done in excel and I need to
pass a start time and end time value back and forth from cells to my
userform. I've tried using military format HHMM and 00\:00. It works
fine passing the time value from the userform to the cell, but not the
other way!! Here's my variable (dim as date):

BeforeEditStartTime = Format(Range("F" & rowindex).Text, "HHMM")

The cell this value is entered in is in custom HHMM format. When I pass
it back to the program it reads (for example) 1200 as 0000 or 12:00:00
AM.

HELP!!
 
J

Jim Thomlinson

Try changing .Text to .Value. The format function takes a date (or number)
and converts it to a text string with a specific format applied. What you are
doing is passing in a string which format can't do too much with...
 
S

sbowman

nevermind I fixed it by formatting the cells as text instead of
general. I'm not doing any time calculations, so it's fine to have it
as text instead of a date.

Thanks anyway...
Shelley
 

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