Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

Hi Guys and Gals,

I have a start button. This should start a timer. The stop button(whe
clicked) should calculate the time difference between the start an
stop events. How would I do this? I am basically monitoring a user'
activities to see exactly how long it takes them to carry out a certai
task.

Cheers people
Josep

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

when u click start, capture the current time and when you click sto
again capture the current time. find the difference between the two
Roughly speaking

startTime = now()
endTime = now()

totalTimeDays = endTime - startTime (this will give you time in days)

If you want in seconds, mutiply totalTimeDays with nos of seconds

totalTimeSecs = totalTimeDays * (24*60*60)

Manges

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

Hi Mangesh,

This is more or less what I'm looking for, but I don't want the dat
part, I know you can use Format to to get what you want, but Im a bi
unsure as to the syntax? I need the difference to be displayed in HH:M
format?

Cheer

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

so its all the more simple. you jsut have to find the diff i.e
totalTimeDays and then format the cell to display the result in HH:MM

Manges

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

I see what you're saying, but this is going to be done in a form an
then saved to a database, so the formatting has to be done in code. Th
other problem i'm having is the the startTime and endTime variables ar
storing the same value from the Now() function. Here is the code:

Dim startTime, endTime
startTime = Now()
endTime = Now()
MsgBox (startTime)
MsgBox (endTime)
MsgBox (Format(startTime - endTime, "HH:MM:SS")

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

Its ok Mangesh, I finally figured out that it was the position of the
variables in the code that was throwing it. Thanks for your help.


---
Message posted from http://www.ExcelForum.com/

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Time Difference between two events

yes ofcourse. You need to place the start so that the line is executed
right after you click the start button. And similar is the end button

mangesh


---
Message posted from http://www.ExcelForum.com/

Reply
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
# Events over time? Jon M Excel Discussion (Misc queries) 2 May 23rd 09 04:37 PM
Need formula for time between two events k1ngr Excel Worksheet Functions 5 February 27th 08 05:37 AM
subtract the time difference from another time difference Dannigirl Excel Discussion (Misc queries) 3 September 30th 07 03:47 PM
Having Events Run at specified time. Rich Cooper Excel Programming 1 May 14th 04 03:49 PM
Run Time control events Christof DB Excel Programming 5 December 5th 03 03:56 PM


All times are GMT +1. The time now is 04:40 PM.

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

About Us

"It's about Microsoft Excel"