PDA

View Full Version : working with Time



jec3300
05-08-2006, 05:12 AM
I am having a problem working with time in VBA. What I would like to do is take minutes and seconds and then multiply this by a ratio and then have the result come back as time (minutes and seconds). Any Ideas?

Thanks


:help

stanl
05-08-2006, 06:23 AM
How is your original data stored? As a string MM:SS, as a 2 numeric cells minutes/seconds, as a datetime field?:dunno Stan

jec3300
05-08-2006, 06:30 AM
I currently have them in two text boxes one for minutes and one for seconds, and was going to convert the minutes into seconds and adding them to the seconds and then multiplying by the conversion factor. If there is a better way of doing this I am all ears. What I would like to do is not have to use any excel cells. This is just a simple converter form. I hope this clears things up a little. :think:

Cyberdude
05-08-2006, 02:58 PM
The scheme you mentioned might work OK, but I'd first like to know if the results of the conversion will ever exceed 60 minutes or 60 seconds. I don't suppose greater than 60 seconds would hurt anything, but depending on what you are doing, exceeding 60 minutes might cause problems.

You said working with time in VBA is giving you problems. Can you be more specific about what happens?

jec3300
05-09-2006, 04:57 AM
This is a time converter from a meter length pool to a yard length pool. So the times will never exceed 60 minutes. The most that will ever happen is 3 to 4 minutes. Is there a way to format a text box to mm/ss? What is happening is when I input the time it is not converting correctly.

Cyberdude
05-14-2006, 09:02 PM
I hate to be so dense about this, but I'm unsure about what you are calling a "text box". There is such a thing as a text box (I use them on charts a lot) that can get what they display from a cell on the worksheet. They call that something like linking the value. If that's what you are doing, then it should be easy to format the contents of the cell where the data is. Sorry, I have to leave now.