Excel tips, tricks and tutorials for the intermediate to advanced user in recording macros, writing scripts in VBA, and creating user-defined functions while optimizing performance.
Popular Posts
Saturday, February 5, 2011
Friday, February 4, 2011
Thursday, February 3, 2011
Wednesday, February 2, 2011
Tuesday, February 1, 2011
Time my macro
Want a quick way to time your macro or demonstrate to your user how fast your macro runs? Here is a quick code that will pop up a message box displaying the time it took!
Sub Time()
Dim Start As Long, Ending As Long, Time As Long
Start = Timer()
'insert macro here
Ending = Timer()
Time = Ending - Start
MsgBox "Time lapsed: " & Format(Time / 60, "###.00") & " minutes or " & Time & " seconds"
End Sub
Sub Time()
Dim Start As Long, Ending As Long, Time As Long
Start = Timer()
'insert macro here
Ending = Timer()
Time = Ending - Start
MsgBox "Time lapsed: " & Format(Time / 60, "###.00") & " minutes or " & Time & " seconds"
End Sub
Monday, January 31, 2011
Subscribe to:
Posts (Atom)