The first step in optimizing for speed is finding the slowest sections of code. The Timer
VBA function returns the number of seconds elapsed since midnight with a precision of 1/256th of a second (3.90625 milliseconds) on Windows based PCs. The VBA functions Now
and Time
are only accurate to a second.
Dim start As Double ' Timer returns Single, but converting to Double to avoid
start = Timer ' scientific notation like 3.90625E-03 in the Immediate window
' ... part of the code
Debug.Print Timer - start; "seconds in part 1"
start = Timer
' ... another part of the code
Debug.Print Timer - start; "seconds in part 2"