Here's a really strange one - I have a set of macros that perform simple show/hide operations on a set of columns. Here's one of these macros, the others are very similar (I'm not including the code of all subs/functions being called because I reckon it's not relevant, but will be glad to do so if needed) :
When I execute this code using a Forms button, it runs very quickly (< 1 second).
But when I run it from a shortcut key (e.g. CTRL+SHIFT+K) or using F5 in VBE, there's a significant delay - I can see the "hourglass pointer" for several seconds while it executes.
I've tried unloading all add-ins, no change.
I've tried to write some "checkpoints" to a log file with timestamps to check which part of the code was at fault, but it appears the entire sub just runs slower (instead of seeing all my timestamps in the same 1-second window, they were evenly spread within a 5-second window).
I'm running out of ideas and this is driving me nuts - my application relies on swift response from shortcut keys for a good user experience so I really need to figure this out. Would love to hear any ideas/suggestions!!
Excel 2010 / Windows 7
Code:
Sub EditCurves()
If RangeCheck() = False Then Exit Sub
Application.ScreenUpdating = False
ActiveSheet.Unprotect
ShowColumns "edit"
ShowButtons False, True, True
CopyValues
ActiveSheet.Range("toggle_edit").Value = "edit"
ActiveCell.Offset(0, 1).Select
ActiveSheet.Protect
Application.ScreenUpdating = True
End Sub
When I execute this code using a Forms button, it runs very quickly (< 1 second).
But when I run it from a shortcut key (e.g. CTRL+SHIFT+K) or using F5 in VBE, there's a significant delay - I can see the "hourglass pointer" for several seconds while it executes.
I've tried unloading all add-ins, no change.
I've tried to write some "checkpoints" to a log file with timestamps to check which part of the code was at fault, but it appears the entire sub just runs slower (instead of seeing all my timestamps in the same 1-second window, they were evenly spread within a 5-second window).
I'm running out of ideas and this is driving me nuts - my application relies on swift response from shortcut keys for a good user experience so I really need to figure this out. Would love to hear any ideas/suggestions!!
Excel 2010 / Windows 7