The code I have used in the past to do this is:

Code:
Private Declare Function GetTickCount Lib "kernel32.dll"() As Long

Private Sub Time_Code()
    Dim t as 'Long
    t = GetTickCount
    
    'Put code to be timed here
    
    MsgBox "Code took " & GetTickCount - t & _
        " milliseconds to run.", vbInformation, "Time Taken"
End Sub