I found code that will time how long it takes a macro takes to run (and generate a pop-up box with the time it took.) But that solution (pasted below), would -- if I'm understanding correctly -- require that I insert those lines of code around every macro that I want to time (and I've got like 50+), and then I suppose remove or comment it out if i no longer want the timer to run. That's clunkier than I want.
The holy grail for me would be some sort of checkbox that would let me toggle the timer on/off...so basically I want to tell Excel "When this box is checked, I want you to time any macro I run (and generate the popup letting me know the speed), but when it's unchecked, I don't want my macros timed." That would essentially let me turn it on when I wanted to work in 'troubleshooting mode', and then with a single click turn it off when I'm in work mode. But my current solution relies on lines of code added / deleted to the VBA whenever i want to turn the timer on/off, which isn't practical. Any ideas?
The holy grail for me would be some sort of checkbox that would let me toggle the timer on/off...so basically I want to tell Excel "When this box is checked, I want you to time any macro I run (and generate the popup letting me know the speed), but when it's unchecked, I don't want my macros timed." That would essentially let me turn it on when I wanted to work in 'troubleshooting mode', and then with a single click turn it off when I'm in work mode. But my current solution relies on lines of code added / deleted to the VBA whenever i want to turn the timer on/off, which isn't practical. Any ideas?
Sub CalculateRunTime_Seconds()'PURPOSE: Determine how many seconds it took for code to completely run
Dim StartTime As Double
Dim SecondsElapsed As Double
'Remember time when macro starts
StartTime = Timer
'*****************************
'Insert Your Code Here...
'*****************************
'Determine how many seconds code took to run
SecondsElapsed = Round(Timer - StartTime, 2)
'Notify user in seconds
MsgBox "This code ran successfully in " & SecondsElapsed & " seconds", vbInformation
End Sub