The first 1.40 cases of Timer function
First, the topic:
Requires writing a piece of code, using the Timer function to calculate the time the code runs.
Second, code:
Sub Example _1_040 ()
Dim T, I&, a
t = Timer for
i = 1 to 1000000
a = a + I
Next i
MsgBox timer-t & Amp "Seconds" ' returns 0.046875 seconds end
Sub
Three, code detailed
1. Sub Example _1_040 (): Start statement for Macro program. The macro name is sample _1_040.
2, Dim T, I&, a: Declare variable t,a are variable, i is long integer variable.
3, t = Timer: Assign the time of the system to the variable T.
4, for i = 1 to 1000000: Loop from 1 to 1000000.
5. A = a + I: assigning the a+i value to variable A is actually an additive process.
6, MsgBox timer-t & "Seconds": Use the message box to display the current time minus the time set earlier, get the time to run the entire code.
Timer function
Returns a single that represents the number of seconds from midnight to the current elapsed time.
Timer
Description
In Microsoft windows, the Timer function returns a decimal fraction of a second.