Created
May 9, 2019 02:27
-
-
Save cress-cc/7d6776db5eae2614d6a65b2dddcdb0d1 to your computer and use it in GitHub Desktop.
VBAで処理時間を計測
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' システム起動後の経過時間をミリ秒で取得する関数。 | |
' VBA標準のNow()とかだと秒までしか取れない。 | |
Private Declare Function GetTickCount Lib "kernel32" () As Long | |
Public Sub Main() | |
Dim startTime As Long | |
Dim endTime As Long | |
startTime = GetTickCount() | |
Call 時間のかかる処理 | |
endTime = GetTickCount() | |
Application.StatusBar = Format((endTime - startTime) / 1000, "0.00") & "[秒]" | |
MsgBox "完了" | |
Application.StatusBar = False | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment