A Simple Timer

J

Jay Fincannon

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.
 
C

Chip Pearson

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
 

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

Top