Article ID: 111268
Article Last Modified on 10/11/2006
Sub ElapsedTime() Dim StartTime As Double, EndTime As Double 'Stores start time in variable "StartTime" StartTime = Timer 'Place your code to be timed here 'Stores end time in variable "EndTime" EndTime = Timer 'Prints execution time in the debug window Debug.Print "Execution time in seconds: ", EndTime - StartTime End SubAfter you run the ElapsedTime macro, you can see the elapsed time in the Immediate pane of the Debug window. To view the Immediate pane of the Debug window, click Debug Window on the View menu.
Sub ErrorCodes()
Dim StartTime As Double, EndTime As Double, X
'creates a file of error messages
StartTime = Timer 'Stores start time in variable "StartTime"
Open "vbaerror.txt" For Output As #1
For X = 1 To 3300
Print #1, X, Error$(X)
Next X
Close #1
EndTime = Timer 'Stores end time in variable "endTime"
'Shows Message Box with elapsed time
MsgBox "Execution time in seconds: " + Format$(EndTime - StartTime)
End Sub
Additional query words: 8.00 97 XL97 timing calculating benchmark bench mark XL
Keywords: kbprogramming KB111268