help calculate time

  • Thread starter Thread starter kenrose08
  • Start date Start date
K

kenrose08

Hi,
i'm a newbie...
i need some help on how to calculate *time* and display it i
textbox3.

user inputs time start in textbox1 and
user inputs time finished in textbox2

textbox3 = textbox2 - textbox1

how do i code it using vbscript?

thanks so much
 
Take a look here at Chip's pages.

http://www.cpearson.com/excel/datetime.htm#AddingTimes

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|
| Hi,
| i'm a newbie...
| i need some help on how to calculate *time* and display it in
| textbox3.
|
| user inputs time start in textbox1 and
| user inputs time finished in textbox2
|
| textbox3 = textbox2 - textbox1
|
| how do i code it using vbscript?
|
| thanks so much!
|
|
| --
| kenrose08
| ------------------------------------------------------------------------
| kenrose08's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=22317
| View this thread: http://www.excelforum.com/showthread.php?threadid=566891
|
 
Hello kenrose08,

This maybe more what you are looking for in VBA.

Mytime = TimeValue(TextBox2.Text) - TimeValue(TextBox3.Text)

'24 Hour Format
TextBox3.Text = Format(Mytime, "hh:mm")

'AM PM format
TextBox3.Text = Format(MyTime, "hh:mm AM/PM")

If you need the seconds change "hh:mm" to "hh:mm:ss".

Sincerely,
Leith Ross
 
thank you so much!!!

Leith said:
Hello kenrose08,

This maybe more what you are looking for in VBA.

Mytime = TimeValue(TextBox2.Text) - TimeValue(TextBox3.Text)

'24 Hour Format
TextBox3.Text = Format(Mytime, "hh:mm")

'AM PM format
TextBox3.Text = Format(MyTime, "hh:mm AM/PM")

If you need the seconds change "hh:mm" to "hh:mm:ss".

Sincerely,
Leith Ross
 
thanks! i'll keep it for future reference...
Dave said:
Take a look here at Chip's pages.

http://www.cpearson.com/excel/datetime.htm#AddingTimes

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|
| Hi,
| i'm a newbie...
| i need some help on how to calculate *time* and display it in
| textbox3.
|
| user inputs time start in textbox1 and
| user inputs time finished in textbox2
|
| textbox3 = textbox2 - textbox1
|
| how do i code it using vbscript?
|
| thanks so much!
|
|
| --
| kenrose08
|
------------------------------------------------------------------------
| kenrose08's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=22317
| View this thread:
http://www.excelforum.com/showthread.php?threadid=566891
|
 

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

Back
Top