|
|
|
 |
The best way to set a timer to time your macros
|
Article contributed by Rod Gill
You may sometimes want to compare two different ways of coding something, in
order to find out which method runs faster. VBA has a function called Timer.
It returns a Single representing the number of seconds elapsed since midnight.
Under Windows, the Timer function returns fractional portions of a second
(up to 7 decimal places, making it, in effect, a millisecond timer).
On the Macintosh, the resolution is one second.
So to time your macros, use:
Dim StartTime as
Single
StartTime = Timer
'Rest of your code here
MsgBox "Time taken was: "& (Timer-StartTime) & " seconds"
|