LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default adding & Subtracting date & time in VBA


I have a user form that does the following:

(1) A textbox records the time when the userform opens (and the
employee's use of the form begins); and

(2) a different textbox records the time when the employee presses a
commandbutton signifying the conclusion of the data entry.

(3) In a third text box, I am trying to subtract time #2 from time #1
to calculate the total time spent by the employee on the particular
data entry item.

The code for entry of time in either textbox is simply:
___________
sub startime()
starttime = time
Userform1.textbox1.value = starttime
end sub
____________
sub endtime()
endtime = time
userform1.textbox2.value = endtime
' the following code doesn't work
userform1.textbox3.value = userform1.textbox2.value -
Userform1.textbox1.value
end sub
___________

Ideas? Bonus questions:
(A) I also want the textboxes to format the time as military time
00:00:00.
(B) It would be great if the start-time text box actually looked like a
timer and counter the minutes and seconds in real time


--
jasonsweeney
------------------------------------------------------------------------
jasonsweeney's Profile: http://www.excelforum.com/member.php...fo&userid=5222
View this thread: http://www.excelforum.com/showthread...hreadid=394457

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding and Subtracting a Time with MilliSeconds carl Excel Worksheet Functions 8 April 5th 23 02:41 PM
Adding and subtracting time Terry Bennett Excel Worksheet Functions 2 February 13th 07 12:24 PM
Adding/Subtracting Time Help... killertofu Excel Worksheet Functions 3 February 15th 06 08:49 PM
adding/subtracting time [email protected] Excel Worksheet Functions 5 January 11th 06 02:43 PM
Macros - Adding & Subtracting Time firesurfer262 Excel Programming 2 January 23rd 04 08:16 PM


All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"