Timer Function

Description

Returns the number of seconds elapsed since midnight.

Syntax

Timer

Remarks

The return value of the Timer function is automatically used with the Randomize statement to generate a seed for the Rnd (random-number) function.

See Also

Randomize Statement, Rnd Function, Time Function.

Example

This example uses the Timer function to record the number of seconds taken to print output to the Debug window.


Start = Timer    ' Set start time.
For I = 1 to 50    ' Loop 50 times.
    Debug.Print I    ' Print to Debug window.
Next I
Finish = Timer    ' Set end time.
TotalTime = Finish - Start    ' Calculate total time.