Sometime macros run slower using shortcuts

Copper Contributor

Hello,


So here's my problem, I have a range of cells I want to shift (with some conditions) so I have macros to do it (shiftLeft, shiftRight). First the user needs to select the range, then run the macro through a shortcut (ctrl+alt+Left|Right).
But I noticed it is much slower with shortcuts than pressing F5 in the VBA IDE. Around 3.3 seconds instead of 0.5 seconds.
Obviously I turned off screen updating, events and put calculation on manual.

Moreover, if I first try with a shortcut (runs slow) then try pressing F5 in the IDE (runs fast) and finally trying again with a shortcut, it runs fast as if I just pressed F5.

 

So I was wondering where does this behavior come from ?
Did I do something wrong ?
How can I fix it ?

 

Thank you

3 Replies

@Eadden 

What happens if you run the macro using the shortcut (slow), then run it again using the shortcut? Is it faster the second time?

Running it again with the shortcut isn't faster, it's still slow

@Eadden 

Sorry, no idea...