VBA-実行時間の計測
VBA-実行時間の計測
「Time」関数を利用することで、現在時刻を取得できます。
開始時刻と終了時刻を取得した上で、差分を取得することで処理の実行時間を計算します。
Dim sTime As Date
Dim eTime As Date
Dim aTime As Date
Dim param_check As Variant
Dim depend_check As Variant
Dim all_time As Variant
aTime = Time
sTime = Time
eTime = Time
param_check = (eTime - sTime) * 24 * 60 * 60 & "秒"
sTime = Time
eTime = Time
depend_check = (eTime - sTime) * 24 * 60 * 60 & "秒"
all_time = (eTime - aTime) * 24 * 60 * 60 & "秒"
MsgBox "TIME=" & all_time & vbCrLf & _
"(param=" & param_check & ")" & vbCrLf & _
"(depend=" & depend_check & ")"