ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help calculate time (https://www.excelbanter.com/excel-programming/368933-help-calculate-time.html)

kenrose08

help calculate time
 

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

--
kenrose0
-----------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...fo&userid=2231
View this thread: http://www.excelforum.com/showthread.php?threadid=56689


Dave Patrick

help calculate time
 
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

"kenrose08" wrote:
|
| 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...o&userid=22317
| View this thread: http://www.excelforum.com/showthread...hreadid=566891
|



Leith Ross[_692_]

help calculate time
 

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


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=566891


kenrose08[_2_]

help calculate time
 

thank you so much!!!

Leith Ross Wrote:
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



--
kenrose08
------------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...o&userid=22317
View this thread: http://www.excelforum.com/showthread...hreadid=566891


kenrose08[_3_]

help calculate time
 

thanks! i'll keep it for future reference...
Dave Patrick Wrote:
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

"kenrose08" wrote:
|
| 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...o&userid=22317
| View this thread:
http://www.excelforum.com/showthread...hreadid=566891
|



--
kenrose08
------------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...o&userid=22317
View this thread: http://www.excelforum.com/showthread...hreadid=566891



All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com