Skip to main content

Timer

Code to time your script.

Snippet

Sub Main
	Dim sTime1 As String
	Dim sTime2 As String
	Dim iTimeDif As String
	Dim i As Long
	'start time
	sTime1 = Now()
	
	'run your code, loop is for demo purposes
	For i = 1 To 10000000
	Next i
	
	'end time
	sTime2 = Now()
	
	'get the time different in seconds
	iTimeDif = DateDiff("s", sTime1, sTime2)
	MsgBox "Time: " & iTimeDif
End Sub