本文主要介绍VBA中通过timer函数来计时。
'calc cost time by timer
Sub getCostTime()
c = Timer
Dim costTime As Single
Dim i As Long
Dim str As String
Do While i < 50000
str = str & i
i = i + 1
Loop
costTime = Timer - c
Debug.Print (costTime * 1000) & " ms"
End Sub