Timer Function

Returns the number of seconds that have elapsed since 12:00 AM (midnight).

Syntax

Timer

Remarks

The following example uses the Timer function to determine the time it takes to iterate a For...Next loop N times:

Example:

Function TimeIt(N)
   Dim StartTime, EndTime
   StartTime = Timer
   For I = 1 To N
   Next
   EndTime = Timer
   TimeIt = EndTime - StartTime
End Function

Dim N, Duration
N = 1000000   ' Number of iterations.
Duration = TimeIt(N)