Did you ever wonder if one way of doing something was faster than another? If so then the following shows you how to use the GetTickCount API to time any process and find out. This is much more accurate than using a timer.

VB Code:
  1. Option Explicit
  2. Private Declare Function GetTickCount Lib "kernel32" () As Long
  3.  
  4.  
  5.     ' Place this code in any Sub or Function
  6.     Dim lngStart As Long
  7.     Dim lngFinish As Long
  8.     Dim lngCounterOne As Long
  9.     Dim lngCounterTwo As Long
  10.    
  11.     ' Record the start "time"
  12.     lngStart = GetTickCount()
  13.    
  14.     ' Some process that you want to time
  15.     For lngCounterOne = 1 To 1000000
  16.         For lngCounterTwo = 1 To 5
  17.         Next lngCounterTwo
  18.     Next lngCounterOne
  19.    
  20.     ' Record the finish "time"
  21.    
  22.     lngFinish = GetTickCount()
  23.    
  24.     ' Display the difference
  25.     MsgBox CStr(lngFinish - lngStart)