If I want to time how long a small section of code takes to the accuracy of milliseconds, I would like to know what functions will give me that.

Dim startTime = <getTime>

section of code...

Dim endTime = <getTime>

Dim result = endTime - startTime

Anyway, thanks a lot in advance.

Re: measuring milliseconds on excel


you can get time with a API function, timeGetTime().

timeGetTime() returns 1/1000 second.

a sample code:

Declare Function timeGetTime Lib "winmm.dll" () As Long

Dim Begin_time As Single
Dim End_time As Single

Begin_time = timeGetTime

... your code ...

End_time = timeGetTime

MsgBox "taking time : " & Format((End_time - Begin_time) / 1000, "#.000 seconds")

Re: measuring milliseconds on excel


Thanks a lot, that was exactly what I was looking for.