Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default A Simple Timer

I have a Worksheet_Change event that does different things depending
on which column is involved. I would like to set the current time
somewhere when I start entering data and again when I finish.
Entering 'End' triggers a sort routine. I just need to know the time
interval between starting and ending entries.

I know I could look at a clock both times, but that's not as much fun.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default A Simple Timer

Jay,

Try something like

Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Worksheet_Change(ByVal Target As Range)
Dim StartTick As Long
Dim EndTick As Long
StartTick = GetTickCount()
'
' your code here
'
EndTick = GetTickCount()
MsgBox "Elapsed time (milliseconds): " & _
Format(EndTick - StartTick, "#,##0")
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Jay Fincannon" wrote in message
...
I have a Worksheet_Change event that does different things depending
on which column is involved. I would like to set the current time
somewhere when I start entering data and again when I finish.
Entering 'End' triggers a sort routine. I just need to know the time
interval between starting and ending entries.

I know I could look at a clock both times, but that's not as much fun.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default A Simple Timer

That's exactamundo. How would I ever know about Lib "kernel32"() ?


On Thu, 20 Nov 2003 08:13:42 -0600, "Chip Pearson"
wrote:

Jay,

Try something like

Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Worksheet_Change(ByVal Target As Range)
Dim StartTick As Long
Dim EndTick As Long
StartTick = GetTickCount()
'
' your code here
'
EndTick = GetTickCount()
MsgBox "Elapsed time (milliseconds): " & _
Format(EndTick - StartTick, "#,##0")
End Sub


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
Are there any Excel macros for a simple countdown timer? Excel timer macro Excel Discussion (Misc queries) 1 April 12th 10 08:09 PM
Timer Vijay Excel Worksheet Functions 1 April 6th 07 11:00 AM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Timer Don Lloyd Excel Programming 0 October 18th 03 03:40 AM
Timer Don Lloyd Excel Programming 2 October 17th 03 12:33 PM


All times are GMT +1. The time now is 11:13 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"